-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend.optimized
More file actions
37 lines (28 loc) · 1006 Bytes
/
Dockerfile.frontend.optimized
File metadata and controls
37 lines (28 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Multi-stage Dockerfile for Sovereign Map Frontend (Optimized)
# Stage 1: Dependencies
FROM node:22-alpine AS deps
WORKDIR /app
COPY frontend/package*.json ./
RUN npm install --no-audit --no-fund && npm cache clean --force
# Stage 2: Build
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY frontend/ .
RUN npm run build
# Stage 3: Runtime (nginx with minimal attack surface)
FROM nginx:1.26-alpine
WORKDIR /app
# Install only necessary tools
# hadolint ignore=DL3018
RUN apk add --no-cache curl ca-certificates && rm -rf /var/cache/apk/*
# Copy built application from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy optimized nginx configuration
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost/health || exit 1
EXPOSE 80
# Use exec form for proper signal handling
CMD ["nginx", "-g", "daemon off;"]