39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
# =============================================================================
|
|
# AI Growth Technologies — Dockerfile (one-click deploy)
|
|
# Multi-stage build: Node 22 build -> Nginx serve static SPA
|
|
# =============================================================================
|
|
|
|
# ---------- Stage 1: Build the Vite React app ----------
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy workspace manifests first for better layer caching
|
|
COPY package.json package-lock.json ./
|
|
COPY apps/web/package.json ./apps/web/package.json
|
|
|
|
# Install all workspace dependencies (root + apps/web)
|
|
RUN npm ci --no-audit --no-fund
|
|
|
|
# Copy the rest of the source
|
|
COPY . .
|
|
|
|
# Build the frontend -> outputs to /app/dist/apps/web
|
|
RUN npm run build
|
|
|
|
# ---------- Stage 2: Serve with Nginx ----------
|
|
FROM nginx:1.27-alpine AS runner
|
|
|
|
# Clean default nginx static site
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
|
|
# Copy built assets from builder stage
|
|
COPY --from=builder /app/dist/apps/web /usr/share/nginx/html
|
|
|
|
# Custom nginx config (SPA fallback, gzip, cache headers)
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|