feat(infra): went back to alpine and removed package.json merging

- Actually using pnpm workspace...
- Use alpine on both runner and builder container
- runner using lockfile generated by builder container
This commit is contained in:
Maieul BOYER 2025-08-03 16:04:24 +02:00
parent c633200e86
commit f62f21ee18
3 changed files with 17 additions and 38 deletions

View file

@ -1,23 +1,25 @@
FROM guergeiro/pnpm:22-10-slim as builder
FROM guergeiro/pnpm:22-10-alpine as builder
ARG SERVICE
WORKDIR /build
COPY ./@shared/package.json /build/@shared/package.json
COPY ./${SERVICE}/package.json /build/service/package.json
COPY ./${SERVICE}/package.json /build/package.json
COPY ./tsconfig.base.json /build/tsconfig.base.json
COPY ./pnpm-workspace.yaml /build/pnpm-workspace.yaml
COPY @shared/package.json /build/@shared/
COPY ${SERVICE}/package.json /build/service/
COPY tsconfig.base.json pnpm-workspace.yaml package.json /build/
RUN pnpm install;
RUN pnpm install;
COPY ./@shared/ /build/@shared/
COPY ./${SERVICE}/ /build/service/
COPY @shared/ /build/@shared/
COPY ${SERVICE}/ /build/service/
RUN cd /build/service && \
pnpm run build:prod && \
node /build/@shared/scripts/merge.js /build/*/package.json >/dist/package.json && \
cp /build/pnpm-workspace.yaml /dist/pnpm-workspace.yaml;
RUN cd /build/service && \
pnpm run build:prod && \
mkdir -p /dist/@shared /dist/service && \
cp /build/pnpm-workspace.yaml /dist/pnpm-workspace.yaml && \
cp /build/@shared/package.json /dist/@shared/ && \
cp /build/service/package.json /dist/service/ && \
cp /build/package.json /dist/ && \
cp /build/pnpm-lock.yaml /dist/;
FROM guergeiro/pnpm:22-10-alpine
@ -26,6 +28,6 @@ WORKDIR /src
COPY --from=builder /dist /src
RUN pnpm install --prod;
RUN pnpm install --prod --frozen-lockfile;
CMD ["node", "/src/run.cjs"]