nerdware/docker-compose.prod.yml
AyoubBenziza 1bda0e122e feat(web): optional Umami analytics (env-driven)
- inject the Umami script at runtime only when VITE_UMAMI_SRC + VITE_UMAMI_WEBSITE_ID
  are set (so dev/local traffic isn't tracked); website-id is public, not a secret
- web Dockerfile passes them as build args; docker-compose.prod.yml + env examples
  document them (optional, empty = disabled)

Verified: build bakes the values in when set; skipped when unset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 08:40:35 +02:00

67 lines
1.9 KiB
YAML

# Stack de production NerdWare (postgres + serveur + client).
# Pensé pour Dokploy (assigne les domaines via Traefik) ou un `docker compose up`.
#
# Variables attendues (UI Dokploy ou fichier .env à côté de ce fichier) :
# POSTGRES_PASSWORD mot de passe Postgres
# ADMIN_TOKEN jeton du back-office quiz
# CORS_ORIGINS domaine(s) du client, ex. https://nerdware.example.com
# VITE_SERVER_URL URL publique du serveur, ex. https://api.nerdware.example.com
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-nerdware}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nerdware}
POSTGRES_DB: ${POSTGRES_DB:-nerdware}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nerdware} -d ${POSTGRES_DB:-nerdware}"]
interval: 5s
timeout: 5s
retries: 5
server:
build:
context: .
dockerfile: apps/server/Dockerfile
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
NODE_ENV: production
HOST: 0.0.0.0
PORT: 3001
# Connexion via PG* (mot de passe passé tel quel, pas d'encodage d'URL).
PGHOST: postgres
PGPORT: 5432
PGUSER: ${POSTGRES_USER:-nerdware}
PGPASSWORD: ${POSTGRES_PASSWORD:-nerdware}
PGDATABASE: ${POSTGRES_DB:-nerdware}
ADMIN_TOKEN: ${ADMIN_TOKEN}
CORS_ORIGINS: ${CORS_ORIGINS}
UPLOADS_DIR: /data/uploads
volumes:
- uploads:/data/uploads
expose:
- "3001"
web:
build:
context: .
dockerfile: apps/web/Dockerfile
args:
VITE_SERVER_URL: ${VITE_SERVER_URL}
VITE_UMAMI_SRC: ${VITE_UMAMI_SRC:-}
VITE_UMAMI_WEBSITE_ID: ${VITE_UMAMI_WEBSITE_ID:-}
restart: unless-stopped
depends_on:
- server
expose:
- "80"
volumes:
pgdata:
uploads: