services: postgres: image: postgres:16.10-bookworm restart: unless-stopped environment: POSTGRES_USER: ${DB_USER} POSTGRES_DB: ${DB_NAME} POSTGRES_PASSWORD: ${DB_PASSWORD} volumes: - pgdata:/var/lib/postgresql/data ports: - "127.0.0.1:${DB_HOST_PORT:-5432}:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] interval: 5s timeout: 3s retries: 10 redis: image: redis:7.4.2-bookworm restart: unless-stopped command: ["redis-server", "/usr/local/etc/redis/redis.conf", "--requirepass", "${REDIS_PASSWORD}"] environment: REDISCLI_AUTH: ${REDIS_PASSWORD} volumes: - ./infra/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro - redisdata:/data ports: - "127.0.0.1:${REDIS_HOST_PORT:-6379}:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 10 migrate: build: . image: mtusi-messenger:lab2 command: ["alembic", "upgrade", "head"] env_file: .env depends_on: postgres: condition: service_healthy restart: "no" api: build: . image: mtusi-messenger:lab2 restart: unless-stopped env_file: .env environment: SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} ports: - "127.0.0.1:${API_HOST_PORT:-8080}:${APP_PORT:-8080}" depends_on: postgres: condition: service_healthy redis: condition: service_healthy migrate: condition: service_completed_successfully volumes: pgdata: redisdata: