kerf-engine/docker/Dockerfile.app
jlightner 80ca11409c feat: Create Dockerfile.app (node→nginx multi-stage), nginx.conf (SPA +…
- "docker/Dockerfile.app"
- "docker/nginx.conf"
- "docker-compose.yml"

GSD-Task: S02/T01
2026-03-26 06:43:59 +00:00

39 lines
1 KiB
Erlang

# Kerf App multi-stage Docker build
# Stage 1: Build the Vite/React app
# Stage 2: Serve via nginx with reverse-proxy to engine
# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /build
# Copy root workspace config first (npm ci needs it for workspace resolution)
COPY package.json package-lock.json ./
# Copy the app workspace
COPY app/ ./app/
# Install dependencies from the workspace root
RUN npm ci --workspace=app
# Build the app (tsc -b && vite build)
RUN npm run build --workspace=app
# Stage 2: Runtime nginx serving static files
FROM nginx:1.27-alpine AS runtime
# Remove default nginx site
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx config
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
# Copy built assets from builder
COPY --from=builder /build/app/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=15s --timeout=5s --start-period=5s --retries=3 \
CMD wget -qO- http://127.0.0.1:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]