version: "3.9" services: backend: build: context: ./backend container_name: stellar-goal-vault-backend ports: - "3001:3001" env_file: - ./backend/.env restart: unless-stopped healthcheck: # Probe the backend REST API health endpoint. # interval: how often Docker polls after the container starts. # timeout: how long a single probe may take before it is considered failed. # retries: consecutive failures before the container is marked unhealthy. # start_period: grace window after container start before failures count. test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"] interval: 15s timeout: 5s retries: 3 start_period: 10s frontend: build: context: ./frontend container_name: stellar-goal-vault-frontend ports: - "3000:3000" environment: - VITE_API_URL=/api depends_on: # Wait until the backend passes its health check before starting frontend. backend: condition: service_healthy restart: unless-stopped healthcheck: # Probe the frontend HTTP server root. # Same timing parameters as the backend for consistency. test: ["CMD", "curl", "-f", "http://localhost:3000"] interval: 15s timeout: 5s retries: 3 start_period: 10s nginx: image: nginx:1.27-alpine container_name: stellar-goal-vault-nginx depends_on: backend: condition: service_healthy frontend: condition: service_healthy ports: - "8080:80" - "8443:443" volumes: - ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf:ro - nginx-certs:/etc/nginx/certs command: > /bin/sh -c " if [ ! -f /etc/nginx/certs/dev.crt ]; then apk add --no-cache openssl >/dev/null && openssl req -x509 -nodes -newkey rsa:2048 -days 365 \ -keyout /etc/nginx/certs/dev.key \ -out /etc/nginx/certs/dev.crt \ -subj '/CN=localhost'; fi; nginx -g 'daemon off;' " restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-check-certificate", "-q", "--spider", "https://localhost/api/health"] interval: 15s timeout: 5s retries: 3 start_period: 10s volumes: nginx-certs: