-
Notifications
You must be signed in to change notification settings - Fork 29
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
build: bash shell for production docker builds #6469
base: master
Are you sure you want to change the base?
Changes from all commits
5ca2bdc
01340c3
0f24ff5
377b655
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,6 @@ WORKDIR /usr/src/ | |
|
||
ADD package.json /usr/src/ | ||
|
||
ADD yarn.lock /usr/src/ | ||
|
||
COPY .yarn /usr/src/.yarn | ||
|
||
ADD .yarnrc /usr/src/ | ||
|
@@ -40,6 +38,8 @@ ADD lerna.json /usr/src/ | |
|
||
COPY ./packages /usr/src/packages | ||
|
||
ADD yarn.lock /usr/src/ | ||
|
||
RUN chown -R node:node . | ||
|
||
USER node | ||
|
@@ -64,16 +64,16 @@ RUN mkdir -p /usr/src | |
|
||
WORKDIR /usr/src/ | ||
|
||
ADD package.json /usr/src/ | ||
|
||
ADD yarn.lock /usr/src/ | ||
COPY --from=builder /usr/src/package.json /usr/src/package.json | ||
|
||
COPY .yarn /usr/src/.yarn | ||
COPY --from=builder /usr/src/.yarn /usr/src/.yarn | ||
|
||
ADD .yarnrc /usr/src/ | ||
COPY --from=builder /usr/src/.yarnrc /usr/src/.yarnrc | ||
|
||
COPY --from=builder /usr/src/packages ./packages | ||
|
||
COPY --from=builder /usr/src/yarn.lock /usr/src/yarn.lock | ||
|
||
Comment on lines
+67
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Everything that the production runner uses should be copied from the builder image. |
||
RUN --mount=type=cache,id=fem-runner-yarn,uid=1000,gid=1000,target=/home/node/.yarn YARN_CACHE_FOLDER=/home/node/.yarn yarn install --production --frozen-lockfile --ignore-scripts --prefer-offline | ||
|
||
RUN rm -rf /usr/src/packages/lib-react-components/src | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
services: | ||
shell: | ||
prod-shell: | ||
image: front-end-monorepo_prod:latest | ||
volumes: | ||
- node_modules-prod:/usr/src/node_modules | ||
build: | ||
context: ./ | ||
args: | ||
- NODE_ENV=production | ||
- PANOPTES_ENV=production | ||
- NEXT_TELEMETRY_DISABLED=1 | ||
- APP_ENV=development | ||
command: | ||
- "/bin/sh" | ||
dev-shell: | ||
image: front-end-monorepo_dev:latest | ||
volumes: | ||
- node_modules:/usr/src/node_modules | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
- node_modules-dev:/usr/src/node_modules | ||
build: | ||
context: ./ | ||
target: builder | ||
|
@@ -46,6 +59,6 @@ services: | |
- PORT=3000 | ||
ports: | ||
- "3003:3000" | ||
|
||
volumes: | ||
node_modules: | ||
node_modules-dev: | ||
node_modules-prod: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ docker compose up -d | |
# stop the local services when you're finished | ||
docker compose down | ||
# run the tests | ||
docker compose run --rm project test | ||
docker compose run --rm root test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small typo. The Next.js app service is called |
||
``` | ||
|
||
### Node | ||
|
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.
yarn.lock
changes quite frequently, so should be added to the image after all other files.