Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@ FROM node:24-alpine AS production

WORKDIR /app

# Copy package files
COPY package*.json ./
# Copy package metadata
COPY --from=builder /app/package.json ./package.json

# Install production dependencies only
RUN npm ci --only=production
# Reuse the dependencies the builder already installed (npm ci installed `pg`
# and the generated Prisma client). This avoids the flaky `npm ci --only=production`
# reinstall that was dropping `pg` from the final image.
COPY --from=builder /app/node_modules ./node_modules

# Copy built files from builder
COPY --from=builder /app/dist ./dist

# Copy Prisma files and generated client
# Copy Prisma files
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/prisma.config.ts ./
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma

# Fail the build loudly if a runtime dependency is missing
RUN node -e "require.resolve('pg'); console.log('dependency check: pg OK')"

# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
Expand Down
Loading
Loading