-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 936 Bytes
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 936 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
39
40
41
42
43
44
45
# Stage 1: Dependencies
FROM node:20-slim AS deps
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
# Only install production dependencies
RUN npm ci --only=production --omit=dev
# Stage 2: Builder
FROM node:20-slim AS builder
WORKDIR /app
# Copy dependencies
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Install dev dependencies for build
RUN npm ci
ENV NEXT_TELEMETRY_DISABLED=1
# Build the application
RUN npm run build
# Stage 3: Runner (Ultra-minimal production image)
FROM gcr.io/distroless/nodejs20-debian12 AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Copy public folder
COPY --from=builder /app/public ./public
# Copy the standalone build (this includes bundled dependencies)
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["server.js"]