- backend/Dockerfile: split builder/runner, runtime libs only, non-root app user, curl for healthcheck, --frozen via new uv.lock - frontend/Dockerfile: npm ci instead of npm install (deterministic), USER node - docker-compose.prod.yml: working backend healthcheck (curl now in image), redis healthcheck, drop dead NEXT_PUBLIC_API_BASE_URL env (Next.js bakes NEXT_PUBLIC_* at build time, runtime override is no-op) - docker-compose.yml: same redis healthcheck, BACKEND_URL for next.config rewrites, drop uv from CMD (not in new image) - Caddyfile: handle (not handle_path) so /api prefix is preserved into FastAPI router - next.config.ts: rewrite /api/* and /health to BACKEND_URL in dev (no Caddy locally) - frontend/src/lib/api.ts: empty default = same-origin relative URLs - Makefile: drop uv run from migrate target - Add backend/uv.lock and frontend/package-lock.json for reproducible builds Verified: docker build succeeds for both, backend container starts, /health responds, curl healthcheck works inside image, container runs as non-root. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
858 B
Docker
35 lines
858 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# ---- deps ----
|
|
FROM node:20-alpine AS deps
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
# --legacy-peer-deps: Tailwind 4 alpha + React 19 peer-dep mismatches.
|
|
RUN npm ci --legacy-peer-deps --no-audit --no-fund
|
|
|
|
|
|
# ---- builder ----
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
|
|
# ---- runner ----
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production \
|
|
NEXT_TELEMETRY_DISABLED=1 \
|
|
PORT=3000
|
|
|
|
# `node` user (uid 1000) ships with the alpine image.
|
|
COPY --from=builder --chown=node:node /app/public ./public
|
|
COPY --from=builder --chown=node:node /app/.next/standalone ./
|
|
COPY --from=builder --chown=node:node /app/.next/static ./.next/static
|
|
|
|
USER node
|
|
|
|
EXPOSE 3000
|
|
CMD ["node", "server.js"]
|