31 lines
527 B
Docker
31 lines
527 B
Docker
# Build stage
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install --yes --omit=dev
|
|
|
|
# Copy source
|
|
COPY . .
|
|
|
|
# Generate static site
|
|
RUN npm run generate
|
|
|
|
# Production stage - static nginx server
|
|
FROM nginx:alpine
|
|
|
|
# Copy nginx config
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Copy generated static files from builder
|
|
COPY --from=builder /app/.output/public /usr/share/nginx/html
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|