Skip to content
Open
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
npm-debug.log
.env
.git
.gitignore
Dockerfile
docker-compose.yml
.vscode
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:18-alpine AS deps
WORKDIR /app

RUN apk add --no-cache openssl

COPY package*.json ./
RUN npm ci

FROM node:18-alpine AS builder
WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY . .

RUN npx prisma generate

RUN npm run build
Comment on lines +15 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Install openssl in the builder stage.

npx prisma generate runs in this stage, but this layer never installs openssl, so the Prisma engine fails with libssl.so missing on Alpine. Install it (and keep it cached) before calling prisma generate.

 FROM node:18-alpine AS builder
 WORKDIR /app

+RUN apk add --no-cache openssl
+
 COPY --from=deps /app/node_modules ./node_modules
 COPY . .
 
 RUN npx prisma generate
🤖 Prompt for AI Agents
In Dockerfile around lines 15 to 17, the builder stage runs "npx prisma
generate" but never installs OpenSSL, causing Prisma's engine to fail with a
missing libssl.so; add an installation step for OpenSSL in the builder stage
before running "npx prisma generate" (for Alpine: RUN apk add --no-cache
openssl) and place it in an earlier layer (before npm install / prisma generate)
so the package is cached between builds.


FROM node:18-alpine AS runner
WORKDIR /app

RUN apk add --no-cache openssl

ENV NODE_ENV=production
ENV PORT=3000

COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public

EXPOSE 3000

CMD npx prisma migrate deploy && npm start