services: api: build: context: . dockerfile: Dockerfile.api ports: - "8000:8000" environment: - APP_PATH=/app - DEBUG=${DEBUG} - DB_HOST=${DB_HOST} - DB_PORT=${DB_PORT} - DB_USER=${DB_USER} - DB_PASS=${DB_PASS} - DB_NAME=${DB_NAME} # Redis connection (external) - REDIS_HOST=${REDIS_HOST} - REDIS_PORT=${REDIS_PORT} - REDIS_DB=${REDIS_DB} - REDIS_PASSWORD=${REDIS_PASSWORD} - SECRET_KEY=${SECRET_KEY} - ADMIN_KEY=${ADMIN_KEY} - DOCS_USERNAME=${DOCS_USERNAME} - DOCS_PASSWORD=${DOCS_PASSWORD} volumes: - ./data/radar:/app/data/radar restart: unless-stopped web-react: build: context: ./web-react dockerfile: Dockerfile ports: - "80:80" depends_on: - api restart: unless-stopped stats-react: build: context: ./stats-react dockerfile: Dockerfile ports: - "8081:80" depends_on: - api restart: unless-stopped # ── Локальные БД (опционально) ───────────────────────────────────────── # По умолчанию api ходит на внешние DB_HOST/REDIS_HOST из .env. Эти два # сервиса поднимаются только явным флагом профиля: # docker compose --profile local-db up -d postgres: image: postgres:latest container_name: postgres profiles: ["local-db"] ports: - "5432:5432" environment: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - PGDATA=/var/lib/postgresql/data/pgdata volumes: - ./data/postgres:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 10 start_period: 10s redis: image: redis:alpine container_name: redis profiles: ["local-db"] command: > redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes --appendfsync everysec --maxmemory 256mb --maxmemory-policy volatile-lru --tcp-keepalive 60 --timeout 300 --loglevel notice ports: - 6379:6379 volumes: - ./data/redis:/data restart: always