Update Dockerfile to install all dependencies for build and optimize production setup

- Changed the installation command to include all dependencies necessary for the build process.
- Updated comments for clarity regarding the installation of production dependencies and rebuilding critical native modules.
This commit is contained in:
T. Narantuya 2025-08-30 10:58:31 +09:00
parent cc7235e79c
commit e13f63cf0c

View File

@ -21,7 +21,7 @@ COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
COPY packages/shared/package.json ./packages/shared/
COPY apps/bff/package.json ./apps/bff/
# Install dependencies with frozen lockfile
# Install ALL dependencies (needed for build)
RUN pnpm install --frozen-lockfile --prefer-offline
# =====================================================
@ -76,12 +76,11 @@ 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 (no dev dependencies)
# Skip scripts to avoid Husky, but allow other necessary postinstall scripts later
# Install ONLY production dependencies (lightweight)
ENV HUSKY=0
RUN pnpm install --frozen-lockfile --prod --ignore-scripts
# Run only necessary postinstall scripts (Prisma, bcrypt, etc.)
# Rebuild only critical native modules
RUN pnpm rebuild bcrypt @prisma/client @prisma/engines
# Copy built applications from builder