35 lines
730 B
Docker
35 lines
730 B
Docker
# Multi-stage build for frontend
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
COPY frontend/package.json ./
|
|
|
|
# Install dependencies without package-lock.json constraints
|
|
RUN npm install
|
|
|
|
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;"] |