-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.fast
More file actions
34 lines (25 loc) · 847 Bytes
/
Dockerfile.fast
File metadata and controls
34 lines (25 loc) · 847 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
# Optimized single-stage build for speed
FROM node:25-alpine AS builder
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci --omit=dev --force
# Copy source and build
COPY . .
RUN npm run build
# Production stage
FROM nginx:1.27-alpine
# Install curl for health checks
RUN apk add --no-cache curl
# Copy nginx config and built files
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/dist /usr/share/nginx/html
COPY docs /usr/share/nginx/html/docs
# Create version file
ARG VERSION=dev
RUN echo "{\"version\":\"$VERSION\",\"build_date\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > /usr/share/nginx/html/version.json
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]