-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 720 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 720 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
# ---- Base Stage ----
FROM node:20-alpine AS base
WORKDIR /app
COPY package*.json ./
# Install dependencies (only production deps for speed)
RUN npm ci --include=dev
# ---- Build Stage ----
FROM base AS builder
COPY . .
# Build Next.js app
RUN npm run build
# ---- Production Stage ----
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Disable telemetry
ENV NEXT_TELEMETRY_DISABLED 1
# Copy only required output
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/next.config.ts ./
# Next.js needs its standalone server
RUN npm install next
EXPOSE 3000
ENV PORT=3000
CMD ["npm", "run", "start"]