-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce docker image size from 2gb to 300mb
- Loading branch information
1 parent
9792ced
commit 95fd0b9
Showing
5 changed files
with
55 additions
and
19 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This dockerfile only builds the javascript part of the project, so tsc and angular compilation | ||
|
||
FROM node:18.8 AS BUILDER_STAGE1 | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
ADD . /picsur | ||
WORKDIR /picsur | ||
|
||
RUN yarn workspaces focus -A | ||
|
||
RUN yarn workspace picsur-shared build | ||
RUN yarn workspace picsur-frontend build | ||
RUN yarn workspace picsur-backend build | ||
|
||
RUN mkdir -p /trimmed | ||
|
||
RUN cp -r --parents ./{package.json,yarn.lock,.yarnrc.yml,branding} /trimmed | ||
RUN cp -r --parents ./{frontend,backend,shared}/{dist,package.json} /trimmed | ||
|
||
FROM scratch | ||
|
||
WORKDIR /picsur | ||
ADD .yarn .yarn | ||
COPY --from=BUILDER_STAGE1 /trimmed ./ |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This dockerfile than builds the production dependencies and the final image | ||
|
||
# Always fetch amd64 image | ||
FROM ghcr.io/rubikscraft/picsur-alpha-stage1:latest AS BUILDER_STAGE1 | ||
|
||
FROM node:18.8-alpine AS BUILDER_STAGE2 | ||
|
||
RUN apk add python3 build-base | ||
|
||
WORKDIR /picsur | ||
COPY --from=BUILDER_STAGE1 /picsur ./ | ||
|
||
RUN yarn workspaces focus -A --production | ||
|
||
FROM node:18.8-alpine | ||
|
||
ENV PICSUR_PRODUCTION=true | ||
|
||
WORKDIR /picsur | ||
COPY --from=BUILDER_STAGE2 /picsur ./ | ||
|
||
CMD yarn workspace picsur-backend start:prod |
This file was deleted.
Oops, something went wrong.