feat(docker): Multi stage docker now fetch deps once
Split dockerfile into three different dockerfiles such that dependencies are only downloaded once This allows the build to be a bit faster, since all deps are downloaded once at the start. This also makes it so the frontend container no longer needs to be ran, as its files are directly embedded into the nginx container This also remove the extra files, since bind mounts do work it also remove the entrypoint.sh file, as you should prefer to not use it
This commit is contained in:
parent
af13395f2f
commit
2ed524872b
17 changed files with 93 additions and 128 deletions
|
|
@ -1,11 +1,8 @@
|
|||
FROM node:22-alpine AS pnpm_base
|
||||
RUN npm install --global pnpm@10;
|
||||
|
||||
FROM pnpm_base AS deps
|
||||
|
||||
COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml /src/
|
||||
WORKDIR /src
|
||||
RUN pnpm install --frozen-lockfile;
|
||||
RUN pnpm install -q --frozen-lockfile;
|
||||
|
||||
FROM pnpm_base AS builder
|
||||
|
||||
|
|
@ -14,12 +11,3 @@ COPY --from=deps /src/node_modules /src/node_modules
|
|||
COPY . /src
|
||||
|
||||
RUN pnpm run build;
|
||||
|
||||
FROM pnpm_base
|
||||
|
||||
COPY --from=builder /src/dist /dist
|
||||
COPY ./run.sh /bin/run.sh
|
||||
|
||||
RUN chmod +x /bin/run.sh
|
||||
|
||||
CMD [ "/bin/run.sh" ]
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
rm -rf /volumes/static/app
|
||||
mkdir -p /volumes/static/app
|
||||
|
||||
cp -r /dist/* /volumes/static/app/
|
||||
Loading…
Add table
Add a link
Reference in a new issue