Files

28 lines
559 B
Docker

# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
# Copy dependency files first for better layer caching
COPY package*.json ./
RUN npm ci
# Copy source code and build the static SPA
COPY . .
RUN npm run build
# Runtime stage
FROM nginx:alpine
# Copy the built static files to nginx's default document root
COPY --from=builder /app/build /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose the port nginx listens on
EXPOSE 80
# Run nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]