version: '3.8' services: app: build: context: . dockerfile: Dockerfile container_name: test_project_app ports: - "${PORT:-8000}:8000" environment: - ENV=production - DATABASE_URL=${DATABASE_URL} - JWT_SECRET=${JWT_SECRET} - REDIS_HOST=redis - REDIS_PORT=6379 depends_on: - postgres - redis networks: - test_project_network restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 postgres: image: postgres:15-alpine container_name: test_project_postgres environment: - POSTGRES_DB=${POSTGRES_DB:-test_project_db} - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres} ports: - "${POSTGRES_PORT:-5432}:5432" volumes: - postgres_data:/var/lib/postgresql/data networks: - test_project_network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7-alpine container_name: test_project_redis ports: - "${REDIS_PORT:-6379}:6379" volumes: - redis_data:/data networks: - test_project_network restart: unless-stopped healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 volumes: postgres_data: redis_data: networks: test_project_network: driver: bridge