diff --git a/Backend/Dockerfile b/Backend/Dockerfile index 2f262efb..b959e271 100644 --- a/Backend/Dockerfile +++ b/Backend/Dockerfile @@ -3,12 +3,16 @@ FROM node:20-alpine AS builder WORKDIR /app +# Install build dependencies for native modules (bcrypt, prisma) +RUN apk add --no-cache python3 make g++ + # Copy package files COPY package*.json ./ COPY pnpm-lock.yaml* ./ -# Install pnpm and dependencies -RUN npm install -g pnpm && pnpm install --frozen-lockfile +# Install pnpm and dependencies with build scripts enabled +RUN npm install -g pnpm && \ + pnpm install --frozen-lockfile --ignore-scripts=false # Copy source code COPY . . @@ -24,6 +28,9 @@ FROM node:20-alpine AS production WORKDIR /app +# Install build dependencies for native modules (bcrypt, prisma) +RUN apk add --no-cache python3 make g++ + # Install pnpm RUN npm install -g pnpm @@ -31,14 +38,14 @@ RUN npm install -g pnpm COPY package*.json ./ COPY pnpm-lock.yaml* ./ -# Install production dependencies and prisma for generate -RUN pnpm install --frozen-lockfile +# Install production dependencies with build scripts enabled +RUN pnpm install --frozen-lockfile --ignore-scripts=false # Copy prisma schema and generate client COPY --from=builder /app/prisma ./prisma RUN pnpm prisma:generate -# Remove devDependencies +# Remove devDependencies (keep bcrypt and prisma client) RUN pnpm prune --prod # Copy built files from builder