- packages/bridge/Dockerfile: multi-stage build (node:22-alpine) - frontend/Dockerfile: multi-stage build + nginx:alpine - frontend/nginx.conf: proxy /bridge to bridge service - docker-compose.yml: bridge (3456) + frontend (8080) - .dockerignore: exclude backend/node_modules/dist - Fix vite proxy target to port 3456 - .env with bridge vars (AUTH_MODE=dev)
41 lines
1.7 KiB
Docker
41 lines
1.7 KiB
Docker
# ─────────────────────────────────────────────────────────────
|
|
# Frontend — Multi-stage Docker build
|
|
# Stage 1: install deps + build with Vite
|
|
# Stage 2: serve static with nginx:alpine
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
# ── Stage 1: Build ─────────────────────────────────────────
|
|
FROM node:22-alpine AS build
|
|
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
|
|
WORKDIR /app
|
|
|
|
# Copy workspace scaffolding
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
COPY packages/contracts/package.json packages/contracts/
|
|
COPY frontend/package.json frontend/
|
|
|
|
# Install all dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source
|
|
COPY packages/contracts/ packages/contracts/
|
|
COPY frontend/ frontend/
|
|
|
|
# Build contracts (frontend depends on @kanban/contracts), then frontend
|
|
RUN pnpm --filter @kanban/contracts build && \
|
|
pnpm --filter frontend build
|
|
|
|
# ── Stage 2: Serve ─────────────────────────────────────────
|
|
FROM nginx:alpine AS runtime
|
|
|
|
# Remove default nginx config
|
|
RUN rm -f /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy custom nginx config
|
|
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built frontend
|
|
COPY --from=build /app/frontend/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|