-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 786 Bytes
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 786 Bytes
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
33
34
35
36
37
38
# Stage 1: Builder
FROM node:20-alpine AS builder
WORKDIR /app
# Install system dependencies needed for Prisma
RUN apk add --no-cache openssl
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the project
COPY . .
# Generate Prisma client with musl binary target
RUN npx prisma generate
# Build the Next.js app
RUN npm run build
# Stage 2: Runner
FROM node:20-alpine AS runner
WORKDIR /app
# System dependencies
RUN apk add --no-cache openssl libstdc++ libc6-compat
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.ts ./next.config.ts
EXPOSE 3000
CMD ["npm", "start"]