forked from Dryft-bits/ChronoFactorem
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Dockerize multi stage #35
Open
soumitradev
wants to merge
10
commits into
crux-bphc:master
Choose a base branch
from
soumitradev:dockerize-multi-stage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
10e8e02
fix: make dockerignore recursive
soumitradev bf1fea1
build: move to multi-stage docker build
soumitradev 70b402d
fix: change base path to /chrono and prepare for prod
soumitradev bdb3ffe
fix: fix typo in google auth callback URL
soumitradev 1c8064c
fix: fix google OAuth2 callback URL
soumitradev a87a767
fix: fix homepage URL
soumitradev 2c7775b
fix: move to chrono.crux-bphc.com
soumitradev fea6260
fix: fix package.json on client
soumitradev 70a92d3
fix: fix image name in docker compose
soumitradev 50eab34
fix: fix react routes not being mapped by express
soumitradev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
FROM node:17-bullseye-slim | ||
FROM node:17-bullseye-slim AS chrono-build-stage | ||
ENV NODE_ENV production | ||
RUN apt-get update && apt-get install -y --no-install-recommends dumb-init | ||
WORKDIR /usr/src/app | ||
|
||
COPY client . | ||
|
||
RUN npm ci --omit=dev && NODE_OPTIONS=--openssl-legacy-provider SKIP_PREFLIGHT_CHECK=true npm run build | ||
|
||
# Deploy stage | ||
FROM node:17-bullseye-slim | ||
WORKDIR /usr/src/app | ||
|
||
COPY --chown=node:node . . | ||
RUN rm -rf client | ||
RUN mkdir -p client/build | ||
COPY --from=chrono-build-stage --chown=node:node /usr/src/app/build /usr/src/app/client/build | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends dumb-init && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN npm ci --omit=dev | ||
RUN cd client && npm ci --omit=dev && NODE_OPTIONS=--openssl-legacy-provider SKIP_PREFLIGHT_CHECK=true npm run build | ||
|
||
USER node | ||
CMD ["dumb-init", "npm", "run", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ | |
] | ||
}, | ||
"proxy": "http://localhost:5000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
const prod = { | ||
urls: { | ||
googleAuth: "https://chronofactorem.up.railway.app/api/auth/google", | ||
adminLogin: "https://chrono-dashboard.herokuapp.com/" | ||
} | ||
}; | ||
googleAuth: "https://chrono.crux-bphc.com/api/auth/google", | ||
adminLogin: "https://chrono-dashboard.herokuapp.com/", | ||
}, | ||
} | ||
|
||
const dev = { | ||
urls: { | ||
googleAuth: "http://localhost:5000/api/auth/google", | ||
adminLogin: "http://localhost:3001" | ||
} | ||
}; | ||
adminLogin: "http://localhost:3001", | ||
}, | ||
} | ||
|
||
const configuration = { | ||
// Add common constants here | ||
...(process.env.NODE_ENV === "development" ? dev : prod) | ||
}; | ||
...(process.env.NODE_ENV === "development" ? dev : prod), | ||
} | ||
|
||
export default configuration; | ||
export default configuration |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think explicitly setting
NODE_ENV
again in the deploy stage would be a good idea. Everything else looks good.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this, and I'll be optimizing it a little more (docker cache works really well with pnpm)