Files
website/Dockerfile.prod
2025-11-21 23:18:13 +08:00

41 lines
941 B
Docker

# ============================================================================
# OmniVerse Website Production Dockerfile
# Multi-stage build for optimized image size
# ============================================================================
# Stage 1: Build
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production --ignore-scripts || npm install
# Copy source code
COPY . .
# Build application
RUN npm run build
# Stage 2: Production
FROM nginx:1.25-alpine
# Copy built files
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost/health || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]