version: '3.8' services: postgres: image: postgres:16-alpine environment: POSTGRES_DB: ${POSTGRES_DB} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} DOCKER_ENV: 1 ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data networks: - my_network healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 30s timeout: 10s retries: 5 redis: image: redis/redis-stack:latest ports: - "6379:6379" - "8001:8001" environment: DOCKER_ENV: 1 REDIS_PORT: ${REDIS_PORT} REDIS_HOST: ${REDIS_HOST} networks: - my_network healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s timeout: 5s retries: 5 flower: image: mher/flower:0.9.7 environment: DOCKER_ENV: 1 command: ["flower", "--broker=${BROKER_URL}", "--port=5555"] ports: - 5557:5555 depends_on: - redis networks: - my_network app: build: context: . dockerfile: Dockerfile # Assumes the Dockerfile is in the root directory environment: - DATABASE_URL=${DATABASE_URL} - REDIS_URL=${REDIS_URL} - BROKER_URL=${BROKER_URL} - FLOWER_BASIC_AUTH=${FLOWER_BASIC_AUTH} - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - DOCKER_ENV=1 depends_on: postgres: condition: service_healthy redis: condition: service_healthy networks: - my_network ports: - "8000:8000" command: ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] volumes: postgres_data: networks: my_network: driver: bridge