-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 1.29 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (30 loc) · 1.29 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
33
34
35
36
37
38
39
40
# ============================================================
# 🧱 Runtime Image (uses prebuilt Next.js output)
# ============================================================
FROM node:26-alpine@sha256:0b36e8c136b94cd4fcf02188228e76c31ad5872eef3fec8cbd2eee500cfd9e80 AS runtime
# Set working directory
WORKDIR /app
# Copy dependency files (for runtime only)
COPY package.json package-lock.json* ./
# Install production dependencies
RUN npm ci --omit=dev
# Copy prebuilt Next.js app from CI build artifacts
COPY .next/ .next/
COPY public/ public/
COPY next.config.* ./
COPY package.json ./
# Environment variables
ENV NODE_ENV=production
ENV PORT=3000
# Add non-root user for security
RUN addgroup -g 1001 -S nodejs && adduser -u 1001 -S nextjs -G nodejs
USER nextjs
# Expose the Next.js port
EXPOSE 3000
# Verify the docs content dependency is mounted and the server is serving
# traffic before the orchestrator considers this container healthy. Uses
# Node's built-in http client so no extra package (e.g. curl) is required.
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/api/healthz', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
# Start the production server
CMD ["npm", "start"]