services: api: build: . container_name: trade_api env_file: - .env ports: - "8000:8000" depends_on: postgres: condition: service_healthy redis: condition: service_started restart: unless-stopped postgres: image: postgres:16-alpine container_name: trade_postgres environment: POSTGRES_DB: trade POSTGRES_USER: trade POSTGRES_PASSWORD: trade ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U trade -d trade"] interval: 5s timeout: 5s retries: 10 restart: unless-stopped redis: image: redis:7-alpine container_name: trade_redis ports: - "6379:6379" restart: unless-stopped volumes: postgres_data: