38 lines
1008 B
Docker
38 lines
1008 B
Docker
|
|
# ============================================================
|
||
|
|
# Control Center Frontend — Multi-stage Docker Build
|
||
|
|
# Angular 21 + nginx for static serving + API proxy
|
||
|
|
# ============================================================
|
||
|
|
|
||
|
|
# --- Build Stage ---
|
||
|
|
FROM node:22-slim AS builder
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Install dependencies first (layer caching)
|
||
|
|
COPY package.json package-lock.json ./
|
||
|
|
RUN npm ci
|
||
|
|
|
||
|
|
# Copy source and build production bundle
|
||
|
|
COPY . .
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
# --- Runtime Stage ---
|
||
|
|
FROM nginx:1.27-alpine AS runtime
|
||
|
|
|
||
|
|
# Remove default nginx config
|
||
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
||
|
|
|
||
|
|
# Copy custom nginx config
|
||
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
|
||
|
|
# Copy built Angular app from builder stage
|
||
|
|
COPY --from=builder /app/dist/frontend/browser /usr/share/nginx/html
|
||
|
|
|
||
|
|
# Expose HTTP port
|
||
|
|
EXPOSE 80
|
||
|
|
|
||
|
|
# Health check — confirm nginx is serving
|
||
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||
|
|
CMD wget -qO- http://localhost/ || exit 1
|
||
|
|
|
||
|
|
CMD ["nginx", "-g", "daemon off;"]
|