Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DN-2: nextjs 14 app dir #23

Merged
merged 235 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
75bd80a
DN-2
dereckmezquita Jun 11, 2024
2b49a5e
DN-2
dereckmezquita Jun 11, 2024
5b51e24
DN-2
dereckmezquita Jun 11, 2024
c53a26c
DN-2
dereckmezquita Jun 11, 2024
c7168f9
DN-2
dereckmezquita Jun 12, 2024
426b828
DN-2
dereckmezquita Jun 12, 2024
f97c49b
DN-2
dereckmezquita Jun 12, 2024
2906dfe
DN-2
dereckmezquita Jun 12, 2024
05f674d
DN-2
dereckmezquita Jun 12, 2024
d62e77d
DN-2: Super fix commit messages?
dereckmezquita Jun 12, 2024
d1b0a70
DN-2: Don't need to echo commit message.
dereckmezquita Jun 12, 2024
c57ef50
DN-2: Simple docker compose.
dereckmezquita Jun 12, 2024
35cdc38
DN-2: First draft.
dereckmezquita Jun 12, 2024
2c3a9db
DN-2: Name.
dereckmezquita Jun 12, 2024
078fcda
DN-2: Licencing.
dereckmezquita Jun 12, 2024
860253e
DN-2: Docker works for server.
dereckmezquita Jun 13, 2024
d3039b7
DN-2: Formatting.
dereckmezquita Jun 13, 2024
38d63b1
DN-2: Dockerfile for client.
dereckmezquita Jun 13, 2024
7d89689
DN-2: Docker build files.
dereckmezquita Jun 15, 2024
6fa26d2
DN-2: New project structure!
dereckmezquita Jun 15, 2024
c603adf
DN-2: Updated gitignore for modern nextjs.
dereckmezquita Jun 15, 2024
95c4499
DN-2: New basic nextjs 14 app front end, major rehaul.
dereckmezquita Jun 15, 2024
2031309
DN-2: Updated workflow to use specific versions.
dereckmezquita Jun 15, 2024
1e796f1
DN-2: Correct secrets.
dereckmezquita Jun 15, 2024
08a33bd
DN-2: username namespace for the docker.
dereckmezquita Jun 15, 2024
0fae183
DN-2: Checkout repo first then copy.
dereckmezquita Jun 15, 2024
e86d7f2
DN-2: Correct container name.
dereckmezquita Jun 15, 2024
0fe7d30
DN-2: Concurrently build and push the server and client images.
dereckmezquita Jun 15, 2024
f9808b0
DN-2: Basic nextjs app with app dir.
dereckmezquita Jun 15, 2024
e7b7a57
DN-2: Wrong docker compose command.
dereckmezquita Jun 15, 2024
74d1836
DN-2: Correctly set env vars for deployment.
dereckmezquita Jun 15, 2024
0152715
DN-2: Correctly set env vars for deployment 2.
dereckmezquita Jun 15, 2024
3b769d3
DN-2: Version is wrong?
dereckmezquita Jun 15, 2024
47398c0
DN-2: Declare correctly the env vars.
dereckmezquita Jun 15, 2024
2bcf768
DN-2: Package versions.
dereckmezquita Jun 15, 2024
42d874e
DN-2: Forgot to add the docker tag.
dereckmezquita Jun 15, 2024
b8431df
DN-2: Don't need to expose ports since each container acts as an IP a…
dereckmezquita Jun 16, 2024
9418d75
DN-2: .env file generated from secrets.
dereckmezquita Jun 16, 2024
017e2c1
DN-2: Expost port 3000.
dereckmezquita Jun 16, 2024
e606e1d
DN-2: Clean up base nextjs project.
dereckmezquita Jun 16, 2024
2e375fc
DN-2: Printing API_URL.
dereckmezquita Jun 16, 2024
a87a429
DN-2: Testing ls to see where files are.
dereckmezquita Jun 16, 2024
814dc6f
DN-2: Testing with local package.json to client.
dereckmezquita Jun 16, 2024
04fc36b
DN-2: Set env vars in workflow.
dereckmezquita Jun 16, 2024
689e7cc
DN-2: Output standalone.
dereckmezquita Jun 16, 2024
e54f8be
DN-2: Wrong dir for standalone output.
dereckmezquita Jun 16, 2024
a0ced04
DN-2: Serve static build of website only need rewrites of API calls i…
dereckmezquita Jun 16, 2024
ecab957
DN-2: Try to get version from package.json at the top level.
dereckmezquita Jun 16, 2024
b8dcdc7
DN-2: Delete version from package.json trying to get it from top leve…
dereckmezquita Jun 16, 2024
72a3b7e
DN-2: Figured out the path for the parent package.json.
dereckmezquita Jun 16, 2024
33e5a86
DN-2: Figured out the path for the parent package.json.
dereckmezquita Jun 16, 2024
9613740
DN-2: Correct context?
dereckmezquita Jun 16, 2024
7f586c6
DN-2: Added serve.
dereckmezquita Jun 16, 2024
809b4fa
DN-2: geolocation function.
dereckmezquita Jun 16, 2024
11f8d97
DN-2: Some constants.
dereckmezquita Jun 16, 2024
69fb920
DN-2: Some constants.
dereckmezquita Jun 16, 2024
7081ca8
DN-2: Is auth middlware and User db schema.
dereckmezquita Jun 17, 2024
ae30f54
DN-2: Formatting.
dereckmezquita Jun 17, 2024
3649dbc
DN-2: Working towards adding mdx content with index page.
dereckmezquita Jun 17, 2024
32ee90d
DN-2: Packages for processing mdx.
dereckmezquita Jun 17, 2024
ced4c0b
DN-2: Draft of index page to display posts.
dereckmezquita Jun 17, 2024
8f90118
DN-2: Helper function processes mdx pages.
dereckmezquita Jun 17, 2024
35554c0
DN-2: Custom plugins.
dereckmezquita Jun 17, 2024
1be9bac
DN-2: Added mdx processing functions.
dereckmezquita Jun 17, 2024
9edfdbc
DN-2: Necessary packages for mdx processing with maths.
dereckmezquita Jun 17, 2024
7062461
DN-2: Adding some metadata and constants.
dereckmezquita Jun 17, 2024
c2f97c9
DN-2: Functions to process mdx; don't forget to strip maths when fetc…
dereckmezquita Jun 17, 2024
db34ee6
Application metadata and working on Index page which is used to displ…
dereckmezquita Jun 17, 2024
fd50326
Demo MDX file.
dereckmezquita Jun 17, 2024
16f59ac
Constants.
dereckmezquita Jun 17, 2024
49a895c
Work in progress page to display index page of posts.
dereckmezquita Jun 17, 2024
42125c8
Card component for displaying posts.
dereckmezquita Jun 17, 2024
911fd5c
Dynamically set metadata for a page.
dereckmezquita Jun 17, 2024
ec29587
Formatting.
dereckmezquita Jun 17, 2024
346f44f
Drop cap component.
dereckmezquita Jun 17, 2024
de14685
Building up card previews.
dereckmezquita Jun 17, 2024
426b996
Theme provider for styled-components.
dereckmezquita Jun 17, 2024
7fca2f5
Fixed FOUC by creating registry and wrapping app; this pre-renders cs…
dereckmezquita Jun 17, 2024
eba0b94
Cleanup.
dereckmezquita Jun 17, 2024
67175a6
Global styles component sets background etc.
dereckmezquita Jun 17, 2024
69c0c30
Logo component, need to add fonts now.
dereckmezquita Jun 17, 2024
3965fc3
Added fonts and path to public folder for easy access.
dereckmezquita Jun 17, 2024
04f951c
Added sass imports.
dereckmezquita Jun 17, 2024
08f7645
Added footer.
dereckmezquita Jun 17, 2024
98db80e
Adding navbar.
dereckmezquita Jun 17, 2024
e404f56
Navbar draft 1.
dereckmezquita Jun 17, 2024
ecdc598
Put together link to image via public folder.
dereckmezquita Jun 17, 2024
75d80f0
Ignore public for now.
dereckmezquita Jun 17, 2024
7d0864d
Basic post page display.
dereckmezquita Jun 17, 2024
6a2a15d
Next public env var to dev domain.
dereckmezquita Jun 18, 2024
269a2c0
Cleanup.
dereckmezquita Jun 18, 2024
dd69cb1
PageMetadata interface and now using correct app url.
dereckmezquita Jun 18, 2024
476557c
Correctly building urls.
dereckmezquita Jun 18, 2024
071d3b5
Added mdx components.
dereckmezquita Jun 18, 2024
06709d7
Idk.
dereckmezquita Jun 18, 2024
b9554a5
Basic navbar.
dereckmezquita Jun 18, 2024
ae640f7
Basic post page, will add more styles around it.
dereckmezquita Jun 18, 2024
d80f1f6
Build up app metadata and pass all necessary parts to post.
dereckmezquita Jun 18, 2024
033f50a
Components for custom mdx.
dereckmezquita Jun 18, 2024
215d8c9
Components for posts and dictionaries display.
dereckmezquita Jun 18, 2024
7c413a3
Formatting.
dereckmezquita Jun 18, 2024
64b6785
Comments meta.
dereckmezquita Jun 18, 2024
7a9ce15
Added properties, comments, section, and url the two later are used a…
dereckmezquita Jun 18, 2024
36a02dc
Sidebar v1.
dereckmezquita Jun 18, 2024
cbb6ce0
Working on side bars etc.
dereckmezquita Jun 18, 2024
65d46b2
Comments property is required.
dereckmezquita Jun 18, 2024
d92ead6
Sidebar v1.
dereckmezquita Jun 18, 2024
45d6afc
Added public folder as docker volume.
dereckmezquita Jun 18, 2024
8cd8996
Added courses section.
dereckmezquita Jun 18, 2024
4c22cbf
Added blog posts.
dereckmezquita Jun 18, 2024
532a6be
Sort posts by date most recent first.
dereckmezquita Jun 18, 2024
058f4eb
Fixed syntax highliter.
dereckmezquita Jun 18, 2024
0c0776d
Fixed inline code and did not affect code blocks.
dereckmezquita Jun 18, 2024
3a79418
Sidebar was not getting post section.
dereckmezquita Jun 18, 2024
9c27b57
Added references section.
dereckmezquita Jun 18, 2024
8827f85
Fixed blurb on cards.
dereckmezquita Jun 18, 2024
0ad191e
Working on adding dictionaries.
dereckmezquita Jun 18, 2024
f2d89e2
DN-2: Test commit.
dereckmezquita Jun 18, 2024
5fd5728
DN-2: Helper functions for extracting defintions metadata.
dereckmezquita Jun 18, 2024
c601e02
DN-2: Formatting.
dereckmezquita Jun 18, 2024
25b31ee
DN-2: Process mdx function now allows for dynamic type for the frontm…
dereckmezquita Jun 18, 2024
276c7d5
DN-2: Tightened up with typings.
dereckmezquita Jun 18, 2024
4866281
DN-2: Helper functions to get definitions; with dynamic types.
dereckmezquita Jun 18, 2024
1768796
DN-2: Passing types to processMdx to declare the frontmatter type.
dereckmezquita Jun 18, 2024
327867b
DN-2: Moved to module.
dereckmezquita Jun 19, 2024
a7a969e
DN-2: Moved to module.
dereckmezquita Jun 19, 2024
f40a472
DN-2: Clean up.
dereckmezquita Jun 19, 2024
8816591
DN-2: Moved access check to function.
dereckmezquita Jun 19, 2024
14d3f43
DN-2: Docs metadata type.
dereckmezquita Jun 19, 2024
86a6e74
DN-2: Comment.
dereckmezquita Jun 19, 2024
87416b9
DN-2: Temporary path for importing type.
dereckmezquita Jun 19, 2024
2047db1
DN-2: Temporarily moved the types.
dereckmezquita Jun 19, 2024
aa4a692
DN-2: First working draft of dictionaries.
dereckmezquita Jun 19, 2024
6055ee9
DN-2: Modularising.
dereckmezquita Jun 19, 2024
376aae9
DN-2: Re-organised dictionaries cleanup.
dereckmezquita Jun 19, 2024
97e1ac8
DN-2: Temp.
dereckmezquita Jun 19, 2024
c4c1e47
DN-2: Fix import.
dereckmezquita Jun 19, 2024
9cc0b79
DN-2: Explicit export.
dereckmezquita Jun 19, 2024
024f2d3
DN-2: Named var.
dereckmezquita Jun 20, 2024
95849f3
DN-2: Working on DictionarySidebar.
dereckmezquita Jun 20, 2024
5bd9932
DN-2: Working on dictionary side bar.
dereckmezquita Jun 20, 2024
dfe0ac3
DN-2: Builds, in the process of implementing dictionary.
dereckmezquita Jun 21, 2024
44dc13a
DN-2: Builds, in the process of implementing dictionary.
dereckmezquita Jun 21, 2024
1cf48fb
DN-2: Builds, in the process of implementing dictionary.
dereckmezquita Jun 21, 2024
67902ef
DN-2: trying to implement the tag filter component
dereckmezquita Jun 21, 2024
be5a271
DN-2: First attempt at filtering using a context API to avoid prop dr…
dereckmezquita Jun 21, 2024
2742721
DN-2: First attempt at filtering using a context API to avoid prop dr…
dereckmezquita Jun 21, 2024
3100f17
DN-2: Explanation on how context api works.
dereckmezquita Jun 21, 2024
ab4a6be
DN-2: Comments.
dereckmezquita Jun 21, 2024
92ff349
DN-2: Comments.
dereckmezquita Jun 21, 2024
1119f40
DN-2: Need to filter for non mdx files.
dereckmezquita Jun 21, 2024
966f06b
DN-2: Working filtering on sidebar of dictionary.
dereckmezquita Jun 21, 2024
402b6d6
DN-2: Dictionary title now passed through context api, allows to set …
dereckmezquita Jun 21, 2024
64d5862
DN-2: Dictionary title now passed through context api, allows to set …
dereckmezquita Jun 21, 2024
399c019
DN-2: About section update.
dereckmezquita Jun 21, 2024
baab5cb
DN-2: Basic working filter mechanism for posts; used context api agai…
dereckmezquita Jun 21, 2024
474326d
DN-2: Cleanup and found where to manage style for index page filtering.
dereckmezquita Jun 21, 2024
d0c48e8
DN-2: Formatting.
dereckmezquita Jun 21, 2024
975b10b
DN-2: Cleanup navbar for using filter state context api, passed build…
dereckmezquita Jun 21, 2024
57fbdb4
DN-2: Fixed filter reset between pages bug.
dereckmezquita Jun 21, 2024
971f06a
DN-2: Attempt to fix port mapping for deployment.
dereckmezquita Jun 21, 2024
dc8361b
DN-2: Correctly build and run the app.
dereckmezquita Jun 21, 2024
52e31b4
DN-2: Ready for static release.
dereckmezquita Jun 22, 2024
5a372a1
DN-2: Formatting.
dereckmezquita Jun 22, 2024
4b4ffa9
DN-2: Gold colour theme for new release.
dereckmezquita Jun 22, 2024
ae1fdf4
DN-2: Unpublish demo.
dereckmezquita Jun 22, 2024
939519a
DN-2: Update readme.
dereckmezquita Jun 22, 2024
390d206
DN-2: Logo theme.
dereckmezquita Jun 22, 2024
e3bbaf9
DN-2: Workflow for releasing prod version.
dereckmezquita Jun 22, 2024
b5944f3
DN-2: Installed sharp for image optimisation in production.
dereckmezquita Jun 22, 2024
e1024e5
DN-2: Mapping to other ports for prod so no clash.
dereckmezquita Jun 22, 2024
250863e
DN-2: Print app info.
dereckmezquita Jun 22, 2024
ba15f18
DN-2: Install sharp deps.
dereckmezquita Jun 22, 2024
6c196fc
DN-2: Increase timeout so we can deploy.
dereckmezquita Jun 22, 2024
e9c729a
DN-2: Don't prune so it doesn't take down other idle containers.
dereckmezquita Jun 22, 2024
23c3b20
DN-2: Add sharp in docker.
dereckmezquita Jun 22, 2024
6b192e6
DN-2: Explicit version at footer.
dereckmezquita Jun 22, 2024
b5ce562
DN-2: Explicit version at footer.
dereckmezquita Jun 22, 2024
a4cf39f
DN-2: Better separation between jobs so one doesn't take down the other.
dereckmezquita Jun 22, 2024
a0c5b9b
DN-2: Install sharp globally will fix the image optimisation errors?
dereckmezquita Jun 22, 2024
70afdd3
DN-2: Added sharp to client and output standalone.
dereckmezquita Jun 22, 2024
c5931c5
DN-2: Trying to serve from standalone.
dereckmezquita Jun 22, 2024
57d9544
DN-2: Wrong file name for build.
dereckmezquita Jun 22, 2024
1553149
DN-2: Simplified copy of the build in docker.
dereckmezquita Jun 22, 2024
d4d4b64
DN-2: Need to asset prefix for content to be served in standalone.
dereckmezquita Jun 22, 2024
ffbd206
DN-2: Need to asset prefix for content to be served in standalone.
dereckmezquita Jun 22, 2024
ff4ec09
DN-2: Copy over staic content to the build.
dereckmezquita Jun 22, 2024
a9f2289
DN-2: Asset prefix fixed.
dereckmezquita Jun 22, 2024
c5e1b46
DN-2: Rm then copy.
dereckmezquita Jun 22, 2024
c3900d4
DN-2: Updated dockerfile to install sharp.
dereckmezquita Jun 23, 2024
0b3de16
DN-2: Back to simple dockerfile; not using standalone.
dereckmezquita Jun 23, 2024
5c4cb57
DN-2: Trying to add sharp again!
dereckmezquita Jun 23, 2024
d25a60f
DN-2: Trying to add sharp again!
dereckmezquita Jun 23, 2024
c39595d
DN-2: Different base image to get sharp working.
dereckmezquita Jun 23, 2024
4c030c8
DN-2: Different way to add deps and install global sharp.
dereckmezquita Jun 23, 2024
768bcdd
DN-2: Can't use apk.
dereckmezquita Jun 23, 2024
ef58be8
DN-2: Was installing wrong deps.
dereckmezquita Jun 23, 2024
0340496
DN-2: Don't need to set env var for next.
dereckmezquita Jun 23, 2024
a2850d7
DN-2: Using different image as a base; hopefully sharp works now!
dereckmezquita Jun 23, 2024
3f3b946
DN-2: Using pnpm to install instead.
dereckmezquita Jun 23, 2024
b9f2651
DN-2: Installing sharp then rebuilding.
dereckmezquita Jun 23, 2024
9ab2b01
DN-2: Fuck yarn?
dereckmezquita Jun 23, 2024
70bc87c
DN-2: Reference for how to build sharp.
dereckmezquita Jun 23, 2024
3f62eb5
DN-2: Working page metadata, TODO: refactor to get rid of Metadata co…
dereckmezquita Jun 23, 2024
4ec0a16
DN-2: Formatting.
dereckmezquita Jun 23, 2024
81052cc
DN-2: Clean up.
dereckmezquita Jun 23, 2024
ba9b704
DN-2: Clean up.
dereckmezquita Jun 23, 2024
86fd83c
DN-2: Correctly set page titles.
dereckmezquita Jun 23, 2024
ddee8fa
DN-2: Correctly export metadata and filter blog posts at build time f…
dereckmezquita Jun 23, 2024
c6f5734
DN-2: Fixed hydration error, nested p tags.
dereckmezquita Jun 23, 2024
64fb2a5
DN-2: Helper functions to get metadata when displaying a single defin…
dereckmezquita Jun 23, 2024
fa8b01c
DN-2: Formatting
dereckmezquita Jun 23, 2024
60d5cbe
DN-2: Comments and simple adjustments.
dereckmezquita Jun 23, 2024
4fd491d
DN-2: Allow for displaying definitions.
dereckmezquita Jun 23, 2024
3ff193f
DN-2: Display for single definition.
dereckmezquita Jun 23, 2024
3594498
DN-2: Allow for plugins to be passed to processMdx and passed plugin …
dereckmezquita Jun 23, 2024
d7df3bd
DN-2: Correct path to definitions in dictionary.
dereckmezquita Jun 23, 2024
32f08af
DN-2: Set metadata for dictionary definition.
dereckmezquita Jun 23, 2024
ed6319b
DN-2: Formatting.
dereckmezquita Jun 23, 2024
8f94abf
DN-2: Don't bold side bar definitions.
dereckmezquita Jun 23, 2024
ec13547
DN-2: Going to avoid non ascii characters in filenames; to avoid havi…
dereckmezquita Jun 24, 2024
cbcdc7c
DN-2: Renaming to avoid non-ascii characters in URLs.
dereckmezquita Jun 24, 2024
49109b6
DN-2: Disable scroll when lightbox.
dereckmezquita Jun 24, 2024
34fb2ac
DN-2: Darker anchor links; theme adjustment.
dereckmezquita Jun 24, 2024
fe99dde
DN-2: Fixed metadata dynamic export with graph resolution.
dereckmezquita Jun 24, 2024
2b433e2
DN-2: Fixed the metadataBase by adding the property parsed by new URL…
dereckmezquita Jun 24, 2024
0cf1315
DN-2: Formatting.
dereckmezquita Jun 24, 2024
91ab001
DN-2: Corrected dockerfile for server, and print version of API.
dereckmezquita Jun 24, 2024
fb3cbb2
DN-2: Corrected copying the env file.
dereckmezquita Jun 24, 2024
5b22ef8
DN-2: Passing env vars don't need env file.
dereckmezquita Jun 24, 2024
482e55a
DN-2: Typo.
dereckmezquita Jun 24, 2024
64ddf2a
DN-2: Testing where URL was undefined.
dereckmezquita Jun 24, 2024
c94fa27
DN-2: In github actions generate .env file then copy it into dockerfi…
dereckmezquita Jun 24, 2024
a3dc844
DN-2: Copy env file from the correct location.
dereckmezquita Jun 24, 2024
d800108
DN-2: Uniform code.
dereckmezquita Jun 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
Dockerfile*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
38 changes: 8 additions & 30 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
## Description
# jira ticket

Please include a summary of the changes and which issue is fixed. Also, include relevant motivation and context.
https://singular-ai.atlassian.net/browse/<TICKET-ID>

Fixes # (issue)
# todo list

## Type of Change
- [ ] Version bump
- [ ] Clean up code

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Breaking Change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update
- [ ] Other (Please describe)
# tests updated

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

- [ ] Test A
- [ ] Test B

**Test Configuration**:
- Operating System:
- Node version:
- Other:

## Checklist

- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] integration test
- [ ] unit test
119 changes: 119 additions & 0 deletions .github/workflows/release_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Release Dev Docker image to Linode

on:
push:
branches-ignore:
- 'master'
env:
IMAGE_NAME_SERVER: ${{ secrets.DOCKER_USERNAME }}/derecksnotes-server
IMAGE_NAME_CLIENT: ${{ secrets.DOCKER_USERNAME }}/derecksnotes-client
CONTAINER_NAME_SERVER: dev_linode_derecksnotes-server
CONTAINER_NAME_CLIENT: dev_linode_derecksnotes-client

jobs:
push_to_registry_server:
name: Push Docker server image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create .env file
run: |
echo BUILD_ENV=DEV > ./server/.env
echo API_URL=https://dev.derecksnotes.com/api/ >> ./server/.env
echo SESSION_SECRET=${{ secrets.SESSION_SECRET }} >> ./server/.env
echo MONGO_PASSWORD=${{ secrets.MONGO_PASSWORD }} >> ./server/.env

- name: Build and push server image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./
file: ./server/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME_SERVER }}:latest_dev

push_to_registry_client:
name: Push Docker client image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create .env file
run: |
echo NEXT_PUBLIC_BUILD_ENV=DEV > ./client/.env
echo NEXT_PUBLIC_APP_URL=https://dev.derecksnotes.com/ >> ./client/.env
echo NEXT_PUBLIC_API_URL=https://dev.derecksnotes.com/api/ >> ./client/.env

- name: Build and push client image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./
file: ./client/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME_CLIENT }}:latest_dev

deploy_to_linode:
name: Deploy docker-compose.yml to Linode
needs: [push_to_registry_server, push_to_registry_client]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Create .env file for docker-compose deployment
run: |
echo IMAGE_NAME_SERVER=${{ env.IMAGE_NAME_SERVER }}:latest_dev > .env
echo IMAGE_NAME_CLIENT=${{ env.IMAGE_NAME_CLIENT }}:latest_dev >> .env
echo CONTAINER_NAME_SERVER=${{ env.CONTAINER_NAME_SERVER }} >> .env
echo CONTAINER_NAME_CLIENT=${{ env.CONTAINER_NAME_CLIENT }} >> .env
echo PORT_MAP_SERVER=3001 >> .env
echo PORT_MAP_CLIENT=3000 >> .env

- name: Copy docker-compose.yml to remote server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
password: ${{ secrets.REMOTE_PASSWORD }}
port: ${{ secrets.REMOTE_PORT }}
source: './docker-compose.yml, .env'
target: '/root/dev_docker-compose-derecksnotes/'

- name: Deploy to remote server
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
password: ${{ secrets.REMOTE_PASSWORD }}
port: ${{ secrets.REMOTE_PORT }}
command_timeout: 20m
script: |
cd /root/dev_docker-compose-derecksnotes/
docker pull ${{ env.IMAGE_NAME_SERVER }}:latest_dev
docker pull ${{ env.IMAGE_NAME_CLIENT }}:latest_dev
docker container prune -f
docker system prune -af
docker rm -f ${{ env.CONTAINER_NAME_SERVER }} || true
docker rm -f ${{ env.CONTAINER_NAME_CLIENT }} || true
docker compose --env-file .env --project-name derecksnotes-dev down
docker compose --env-file .env --project-name derecksnotes-dev up -d
131 changes: 131 additions & 0 deletions .github/workflows/release_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Release Prod Docker image to Linode

on:
release:
types: [published]
# on:
# push:
# branches-ignore:
# - 'master'
env:
IMAGE_NAME_SERVER: ${{ secrets.DOCKER_USERNAME }}/derecksnotes-server
IMAGE_NAME_CLIENT: ${{ secrets.DOCKER_USERNAME }}/derecksnotes-client
CONTAINER_NAME_SERVER: prod_linode_derecksnotes-server
CONTAINER_NAME_CLIENT: prod_linode_derecksnotes-client

jobs:
push_to_registry_server:
name: Push Docker server image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create .env file
run: |
echo BUILD_ENV=PROD > ./server/.env
echo API_URL=https://derecksnotes.com/api/ >> ./server/.env
echo SESSION_SECRET=${{ secrets.SESSION_SECRET }} >> ./server/.env
echo MONGO_PASSWORD=${{ secrets.MONGO_PASSWORD }} >> ./server/.env

- name: Build and push server image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./server
file: ./server/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME_SERVER }}:latest_prod
build-args: |
BUILD_ENV=PROD
API_URL=https://derecksnotes.com/api/
SESSION_SECRET=${{ secrets.SESSION_SECRET }}
MONGO_PASSWORD=${{ secrets.MONGO_PASSWORD }}

push_to_registry_client:
name: Push Docker client image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create .env file
run: |
echo NEXT_PUBLIC_BUILD_ENV=PROD > ./client/.env
echo NEXT_PUBLIC_APP_URL=https://derecksnotes.com/ >> ./client/.env
echo NEXT_PUBLIC_API_URL=https://derecksnotes.com/api/ >> ./client/.env

- name: Build and push client image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./
file: ./client/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME_CLIENT }}:latest_prod
build-args: |
NEXT_PUBLIC_BUILD_ENV=PROD
NEXT_PUBLIC_APP_URL=https://derecksnotes.com/
NEXT_PUBLIC_API_URL=https://derecksnotes.com/api/

deploy_to_linode:
name: Deploy docker-compose.yml to Linode
needs: [push_to_registry_server, push_to_registry_client]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Create .env file for docker-compose deployment
run: |
echo IMAGE_NAME_SERVER=${{ env.IMAGE_NAME_SERVER }}:latest_prod > .env
echo IMAGE_NAME_CLIENT=${{ env.IMAGE_NAME_CLIENT }}:latest_prod >> .env
echo CONTAINER_NAME_SERVER=${{ env.CONTAINER_NAME_SERVER }} >> .env
echo CONTAINER_NAME_CLIENT=${{ env.CONTAINER_NAME_CLIENT }} >> .env
echo PORT_MAP_SERVER=3003 >> .env
echo PORT_MAP_CLIENT=3002 >> .env

- name: Copy docker-compose.yml to remote server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
password: ${{ secrets.REMOTE_PASSWORD }}
port: ${{ secrets.REMOTE_PORT }}
source: './docker-compose.yml, .env'
target: '/root/prod_docker-compose-derecksnotes/'

- name: Deploy to remote server
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
password: ${{ secrets.REMOTE_PASSWORD }}
port: ${{ secrets.REMOTE_PORT }}
command_timeout: 20m
script: |
cd /root/prod_docker-compose-derecksnotes/
docker pull ${{ env.IMAGE_NAME_SERVER }}:latest_prod
docker pull ${{ env.IMAGE_NAME_CLIENT }}:latest_prod
docker container prune -f
docker system prune -af
docker rm -f ${{ env.CONTAINER_NAME_SERVER }} || true
docker rm -f ${{ env.CONTAINER_NAME_CLIENT }} || true
docker compose --env-file .env --project-name derecksnotes-prod down
docker compose --env-file .env --project-name derecksnotes-prod up -d
Loading
Loading