File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,16 +21,19 @@ RUN pnpm --filter @hype-stack/backend run generate
2121# Build backend (uses Nx target)
2222RUN npm run backend:build
2323
24+ # We need to set CI=true to limit node_modules to production dependencies.
25+ RUN CI=true pnpm prune --prod
26+
2427FROM node:${NODE_VERSION} AS runner
2528WORKDIR /app
2629ENV NODE_ENV=production
2730
28- # Copy runtime artifacts
29- COPY --from=builder /app /node_modules ./node_modules
30- COPY --from=builder /app/package.json ./package.json
31- COPY --from=builder /app/apps/backend/package.json ./apps/backend/package.json
32- COPY --from=builder /app/apps/backend/dist ./apps/backend/dist
33- COPY --from=builder /app/apps/backend/src/assets ./apps/backend/src/assets
31+ # Copy the whole workspace. In a pnpm monorepo the backend's deps are symlinks
32+ # in apps/backend /node_modules pointing into the root .pnpm store, and workspace
33+ # packages (e.g. @hype-stack/enums) resolve to their built dist in packages/. The
34+ # build externalizes every dependency, so all of these must exist at runtime.
35+ # pnpm prune --prod already trimmed node_modules to production deps in builder.
36+ COPY --from=builder /app ./
3437
3538EXPOSE 2138
3639
You can’t perform that action at this time.
0 commit comments