- express-tools: ExpressServer.serveStaticFrontend() sert le build du frontend (assets + fallback SPA), monté après les routes API et avant le 404 JSON. Opt-in via FRONTEND_DIST_DIR (uniquement défini dans l'image Docker) — le dev natif (dev:api/dev:web) est inchangé. - apps/api/Dockerfile: build aussi apps/web, embarque son dist dans le runtime ; corrige au passage l'oubli de packages/date-tools. Supprime apps/web/Dockerfile et nginx.conf (plus de conteneur nginx séparé). - docker-compose.yml: un seul service "app" (postgres + app), un seul port APP_PORT, plus de WEB_PORT/CORS_ORIGIN à coordonner entre deux origines. Garde `build:` (pas de registre — Portainer build depuis le repo Git). - ci.yml: éclate le job unique lint-and-test+e2e en 4 jobs indépendants (lint/test/build/e2e), sans chaînage, déclenchés sur chaque push (toute branche) + PR vers main. - release.yml (nouveau): sur tag vX.Y.Z, sanity-build de l'image Docker, GitHub Release avec changelog auto-généré, puis notification best-effort du webhook Portainer (secret PORTAINER_WEBHOOK_URL). - README: documente le conteneur unique et le pipeline de release.
45 lines
1.7 KiB
YAML
45 lines
1.7 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
# No defaults on purpose: POSTGRES_USER/PASSWORD/DB must be set in your
|
|
# local, git-ignored .env (see .env.example). Compose fails loudly if
|
|
# they're missing instead of falling back to a guessable credential.
|
|
POSTGRES_USER: ${POSTGRES_USER:?set POSTGRES_USER in .env}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
|
|
POSTGRES_DB: ${POSTGRES_DB:?set POSTGRES_DB in .env}
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Single service serving both the API and the built frontend (see
|
|
# apps/api/Dockerfile) — no separate nginx/web container, no cross-origin
|
|
# CORS_ORIGIN to keep in sync between two ports.
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/api/Dockerfile
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3000
|
|
# Uses the "postgres" service name, not localhost/POSTGRES_PORT —
|
|
# container-to-container traffic stays on the compose network and
|
|
# always targets Postgres's internal port (5432).
|
|
DATABASE_URL: "postgresql://${POSTGRES_USER:?set POSTGRES_USER in .env}:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/${POSTGRES_DB:?set POSTGRES_DB in .env}?schema=public"
|
|
JWT_SECRET: ${JWT_SECRET:?set JWT_SECRET in .env}
|
|
ports:
|
|
- "${APP_PORT:-3000}:3000"
|
|
|
|
volumes:
|
|
postgres_data:
|