-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (23 loc) · 730 Bytes
/
Dockerfile
File metadata and controls
28 lines (23 loc) · 730 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
# Stage 1: Install dependencies and build the Next.js app
FROM node:22.20.0-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
COPY prisma prisma ./
RUN npm ci
# Copy the rest of the application code
COPY . .
#Initialize prisma
RUN npx prisma generate
# Build the Next.js application
RUN npm run build
# Stage 2: Set up the production environment with Nginx
FROM node:22.20.0-alpine
WORKDIR /app
# Copy the built Next.js app and dependencies
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
# Start the Next.js app and Nginx
CMD ["npm", "start"]