Update docker-compose.yml

This commit is contained in:
saulteafarmer 2025-05-14 16:47:49 +00:00
parent 4d2262e48f
commit 4b30c18310

View File

@ -2,7 +2,7 @@ version: "3.8"
services: services:
# ── Postgres ──────────────────────────────────────────────────────────────── # ── Postgres Database ───────────────────────────────────────────────────────
db: db:
image: postgres:15-alpine image: postgres:15-alpine
container_name: lnbits_db container_name: lnbits_db
@ -25,14 +25,22 @@ services:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: discord-lnbits-web container_name: discord-lnbits-web
ports:
- "3000:3000"
environment: environment:
DATABASE_URL: "${DATABASE_URL}" DATABASE_URL: "${DATABASE_URL}"
FLASK_SECRET: "${FLASK_SECRET}" FLASK_SECRET: "${FLASK_SECRET}"
depends_on: depends_on:
db: - db
condition: service_healthy # wait for Postgres then launch Gunicorn
ports: command: >
- "3000:3000" sh -c '
until pg_isready -h db -U "${DB_USER}" ; do
echo "[web] waiting for db…" ;
sleep 2 ;
done ;
exec gunicorn -b 0.0.0.0:3000 app:app
'
restart: unless-stopped restart: unless-stopped
# ── Discord Lightning Bot ────────────────────────────────────────────────── # ── Discord Lightning Bot ──────────────────────────────────────────────────
@ -53,8 +61,16 @@ services:
INVOICE_MESSAGE: "${INVOICE_MESSAGE}" INVOICE_MESSAGE: "${INVOICE_MESSAGE}"
DATABASE_URL: "${DATABASE_URL}" DATABASE_URL: "${DATABASE_URL}"
depends_on: depends_on:
db: - db
condition: service_healthy # wait for Postgres as well, then launch the bot
command: >
sh -c '
until pg_isready -h db -U "${DB_USER}" ; do
echo "[bot] waiting for db…" ;
sleep 2 ;
done ;
exec python3 discord_lnbits_bot.py
'
restart: unless-stopped restart: unless-stopped
volumes: volumes: