42 lines
1.7 KiB
Text
42 lines
1.7 KiB
Text
|
|
# ─────────────────────────────────────────────────────────────
|
||
|
|
# 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;"]
|