diff --git a/Dockerfile b/Dockerfile index fc5b6e6..4123b01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN npm install -g pnpm@10.4.1 node-gyp COPY package.json pnpm-lock.yaml ./ COPY patches/ ./patches/ -# Install dependencies (with node-gyp available) +# Install ALL dependencies (including devDeps for build) RUN pnpm install --frozen-lockfile # Copy source code @@ -38,7 +38,7 @@ RUN pnpm build # ============================================================ FROM node:22-alpine AS production -# Install runtime dependencies +# Install runtime dependencies only (vips for sharp, poppler for PDF) RUN apk add --no-cache \ poppler-utils \ vips \ @@ -46,23 +46,16 @@ RUN apk add --no-cache \ WORKDIR /app -# Install pnpm -RUN npm install -g pnpm@10.4.1 - -# Copy package files -COPY package.json pnpm-lock.yaml ./ -COPY patches/ ./patches/ - -# Install production dependencies only (no build tools needed for prod deps) -RUN apk add --no-cache python3 make g++ gcc libc-dev vips-dev pkgconfig && \ - npm install -g node-gyp && \ - pnpm install --frozen-lockfile --prod && \ - apk del make g++ gcc libc-dev pkgconfig +# Copy node_modules from builder (already compiled, including sharp native binaries) +COPY --from=builder /app/node_modules ./node_modules # Copy built assets from builder COPY --from=builder /app/dist ./dist COPY --from=builder /app/client/dist ./client/dist +# Copy package.json (needed for module resolution) +COPY package.json ./ + # Copy drizzle migrations COPY drizzle/ ./drizzle/ COPY drizzle.config.ts ./