16 lines
429 B
Docker
16 lines
429 B
Docker
# Step 1: Build the static Next.js application
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Step 2: Serve the static files with NGINX
|
|
FROM nginx:alpine
|
|
# Copy the static export from Next.js (the 'out' folder) to the NGINX html directory
|
|
COPY --from=builder /app/out /usr/share/nginx/html
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|