Files
license-manager/Dockerfile.frontend
T
2025-07-31 13:49:40 +08:00

35 lines
750 B
Docker

# Multi-stage build for frontend
FROM node:20-alpine AS builder
WORKDIR /app
COPY frontend/package*.json ./
# Update npm to latest version and install dependencies
RUN npm install -g npm@latest && npm ci
COPY frontend/ ./
RUN npm run prod
# Production stage with Nginx
FROM nginx:alpine
# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Create log directory
RUN mkdir -p /var/log/nginx
# Install curl for health check
RUN apk add --no-cache curl
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]