services: loyal-companion: build: . container_name: loyal-companion restart: unless-stopped env_file: - .env environment: - PYTHONUNBUFFERED=1 - DATABASE_URL=postgresql+asyncpg://companion:${POSTGRES_PASSWORD:-companion}@postgres:5432/loyal_companion depends_on: postgres: condition: service_healthy postgres: image: postgres:16-alpine container_name: loyal-companion-postgres restart: unless-stopped # optional ports: - "5433:5432" environment: POSTGRES_USER: ${POSTGRES_USER:-companion} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-companion} POSTGRES_DB: ${POSTGRES_DB:-loyal_companion} volumes: - postgres_data:/var/lib/postgresql/data - ./schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U companion -d loyal_companion"] interval: 10s timeout: 5s retries: 5 volumes: postgres_data: