From e9c8d193b7e5ea4b50b9a85e6596634ac8e36238 Mon Sep 17 00:00:00 2001 From: "T. Narantuya" Date: Fri, 29 Aug 2025 18:46:20 +0900 Subject: [PATCH] Update Dockerfile to streamline production dependencies and build process - Simplified the installation of production dependencies by copying node_modules from the builder stage. - Enhanced the Dockerfile by removing unnecessary environment variable settings and comments for clarity. - Ensured all necessary built applications and dependencies are included in the final image. --- apps/bff/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/bff/Dockerfile b/apps/bff/Dockerfile index 03c6bc10..018e0727 100644 --- a/apps/bff/Dockerfile +++ b/apps/bff/Dockerfile @@ -71,21 +71,21 @@ RUN corepack enable && corepack prepare pnpm@10.15.0 --activate WORKDIR /app -# Copy workspace configuration for production install +# Copy workspace configuration COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./ COPY packages/shared/package.json ./packages/shared/ COPY apps/bff/package.json ./apps/bff/ -# Install only production dependencies; skip lifecycle scripts to avoid Husky prepare -# Prisma client and native assets are generated in the builder stage and copied below -ENV HUSKY=0 -RUN pnpm install --recursive --frozen-lockfile --prod --ignore-scripts - -# Copy built applications and Prisma client +# Copy built applications and dependencies from builder COPY --from=builder /app/packages/shared/dist ./packages/shared/dist COPY --from=builder /app/apps/bff/dist ./apps/bff/dist COPY --from=builder /app/apps/bff/prisma ./apps/bff/prisma +# Copy node_modules from builder (includes all dependencies) +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/packages/shared/node_modules ./packages/shared/node_modules +COPY --from=builder /app/apps/bff/node_modules ./apps/bff/node_modules + # Generate Prisma client in the production image (ensures engines and client are present) WORKDIR /app/apps/bff RUN pnpm prisma generate