version: "3.9" services: postgres: image: postgres:16-alpine environment: POSTGRES_DB: safemail POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 5 redis: image: redis:7-alpine ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 5 api: build: ./backend command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload ports: - "8000:8000" env_file: ./backend/.env depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ./backend:/app worker: build: ./backend command: celery -A app.worker worker -l info -c 4 env_file: ./backend/.env depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ./backend:/app beat: build: ./backend command: celery -A app.worker beat -l info env_file: ./backend/.env depends_on: - redis volumes: - ./backend:/app volumes: postgres_data: