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:
Maieul BOYER 2025-12-30 17:28:06 +01:00 committed by Maix0
parent af13395f2f
commit 2ed524872b
17 changed files with 93 additions and 128 deletions

View file

@ -0,0 +1,14 @@
FROM pnpm_base AS deps
WORKDIR /build
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml /build/
# You need to list all services here...
COPY @shared/package.json /build/@shared/package.json
COPY auth/package.json /build/auth/package.json
COPY chat/package.json /build/chat/package.json
COPY tic-tac-toe/package.json /build/tic-tac-toe/package.json
COPY user/package.json /build/user/package.json
RUN pnpm install -q --frozen-lockfile;

View file

@ -0,0 +1,3 @@
FROM node:22-alpine AS pnpm_base
RUN npm install --global pnpm@10 --no-fund -q;
RUN apk add make python3 gcc clang build-base musl-dev curl;