version: "3.9" services: db: image: postgres:15 restart: always environment: POSTGRES_USER: "${DB_USER:-postgres}" POSTGRES_PASSWORD: "${DB_PASS:-}" POSTGRES_DB: "${DB_NAME:-lnbitsdb}" volumes: - db_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER}"] interval: 5s timeout: 2s retries: 5 web: build: context: . dockerfile: Dockerfile restart: on-failure depends_on: db: condition: service_healthy env_file: - .env ports: - "3000:3000" # wait for the DB, then launch the Flask app under Gunicorn command: > sh -c " until pg_isready -h db -U \$DB_USER; do echo '[web] waiting for db…'; sleep 1; done && exec gunicorn -b 0.0.0.0:3000 app:app " bot: build: context: . dockerfile: Dockerfile restart: on-failure depends_on: db: condition: service_healthy env_file: - .env # wait for the DB, then run your bot loop command: > sh -c " until pg_isready -h db -U \$DB_USER; do echo '[bot] waiting for db…'; sleep 1; done && exec python discord_lnbits_bot.py " volumes: db_data: