-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (29 loc) · 1.01 KB
/
Copy pathDockerfile
File metadata and controls
32 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
COPY prisma ./prisma/
RUN npm ci
COPY . .
# Config file requires DATABASE_URL to be present
ENV DATABASE_URL=""
RUN npx prisma generate
RUN npm run build
RUN npx tsc --project tsconfig.server.json
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
# Copy node_modules from builder to ensure prisma client is available if needed,
# although npm ci --omit=dev should install @prisma/client if it is in dependencies.
# However, prisma client generation location depends on where it was generated.
# Usually it's in node_modules/.prisma.
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
EXPOSE 3000
EXPOSE 3002
CMD ["node", "dist/server.js"]