Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ COPY packages/backend/src ./packages/backend/src
RUN npm ci \
&& npm run build:prod -w @mocker/backend \
&& npm run minify -w @mocker/backend \
&& npx esbuild /usr/src/app/packages/backend/dist/index.js --bundle --minify --platform=node --target=node20 --format=cjs --outfile=/usr/src/app/packages/backend/dist/runtime.cjs \
&& npm prune --omit=dev \
&& mkdir -p /usr/src/app/images

FROM gcr.io/distroless/nodejs20-debian12:nonroot AS release
Expand All @@ -24,7 +24,8 @@ ENV NODE_ENV=production \
WORKDIR /usr/src/app

# Copy bundled runtime artifact and writable path from build stage.
COPY --from=build --chown=65532:65532 /usr/src/app/packages/backend/dist/runtime.cjs ./runtime.cjs
COPY --from=build --chown=65532:65532 /usr/src/app/packages/backend/dist/index.js ./runtime.cjs
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release stage no longer includes a fully bundled artifact. npm run minify for @mocker/backend uses --packages=external, so dist/index.js will still require() runtime deps (express/typeorm/etc). Since the distroless stage doesn’t copy node_modules, the container will fail at runtime with missing module errors. Consider restoring the dedicated esbuild bundling step (you can drop --minify there to avoid double-minification), or alternatively copy/prune node_modules into the release image (or use a runtime base image that can install prod deps).

Copilot uses AI. Check for mistakes.
COPY --from=build --chown=65532:65532 /usr/src/app/node_modules ./node_modules
COPY --from=build --chown=65532:65532 /usr/src/app/images ./images

EXPOSE 80
Expand Down
Loading