2025-05-14 18:26:09 +00:00
|
|
|
version: "3.9"
|
2025-05-14 16:27:12 +00:00
|
|
|
|
2025-05-11 00:01:04 +00:00
|
|
|
services:
|
2025-05-14 16:27:12 +00:00
|
|
|
db:
|
2025-05-14 18:26:09 +00:00
|
|
|
image: postgres:15
|
|
|
|
restart: always
|
2025-05-14 16:27:12 +00:00
|
|
|
environment:
|
2025-05-14 18:26:09 +00:00
|
|
|
POSTGRES_USER: "${DB_USER:-postgres}"
|
|
|
|
POSTGRES_PASSWORD: "${DB_PASS:-}"
|
|
|
|
POSTGRES_DB: "${DB_NAME:-lnbitsdb}"
|
2025-05-14 16:27:12 +00:00
|
|
|
volumes:
|
2025-05-14 18:26:09 +00:00
|
|
|
- db_data:/var/lib/postgresql/data
|
2025-05-14 16:27:12 +00:00
|
|
|
healthcheck:
|
2025-05-14 18:26:09 +00:00
|
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER}"]
|
|
|
|
interval: 5s
|
|
|
|
timeout: 2s
|
2025-05-14 16:27:12 +00:00
|
|
|
retries: 5
|
2025-05-14 15:10:17 +00:00
|
|
|
|
|
|
|
web:
|
2025-05-14 16:27:12 +00:00
|
|
|
build:
|
|
|
|
context: .
|
2025-05-14 16:39:12 +00:00
|
|
|
dockerfile: Dockerfile
|
2025-05-14 18:26:09 +00:00
|
|
|
restart: on-failure
|
|
|
|
depends_on:
|
|
|
|
db:
|
|
|
|
condition: service_healthy
|
|
|
|
env_file:
|
|
|
|
- .env
|
2025-05-14 16:47:49 +00:00
|
|
|
ports:
|
|
|
|
- "3000:3000"
|
2025-05-14 18:26:09 +00:00
|
|
|
# wait for the DB, then launch the Flask app under Gunicorn
|
2025-05-14 16:47:49 +00:00
|
|
|
command: >
|
2025-05-14 18:26:09 +00:00
|
|
|
sh -c "
|
|
|
|
until pg_isready -h db -U \$DB_USER; do
|
|
|
|
echo '[web] waiting for db…';
|
|
|
|
sleep 1;
|
|
|
|
done &&
|
2025-05-14 16:47:49 +00:00
|
|
|
exec gunicorn -b 0.0.0.0:3000 app:app
|
2025-05-14 18:26:09 +00:00
|
|
|
"
|
2025-05-11 00:01:04 +00:00
|
|
|
|
2025-05-14 16:27:12 +00:00
|
|
|
bot:
|
|
|
|
build:
|
|
|
|
context: .
|
2025-05-14 16:39:12 +00:00
|
|
|
dockerfile: Dockerfile
|
2025-05-14 18:26:09 +00:00
|
|
|
restart: on-failure
|
2025-05-14 16:27:12 +00:00
|
|
|
depends_on:
|
2025-05-14 18:26:09 +00:00
|
|
|
db:
|
|
|
|
condition: service_healthy
|
|
|
|
env_file:
|
|
|
|
- .env
|
|
|
|
# wait for the DB, then run your bot loop
|
2025-05-14 16:47:49 +00:00
|
|
|
command: >
|
2025-05-14 18:26:09 +00:00
|
|
|
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
|
|
|
|
"
|
2025-05-11 00:01:04 +00:00
|
|
|
|
|
|
|
volumes:
|
2025-05-14 18:26:09 +00:00
|
|
|
db_data:
|