Build reusable bot framework
Some checks failed
CI / test (push) Has been cancelled
CI / compose-smoke (push) Has been cancelled

This commit is contained in:
Chelsea Lee
2026-07-19 21:53:24 -05:00
parent 7ecc1107b2
commit fbdf33e894
66 changed files with 8428 additions and 0 deletions

81
docker-compose.yml Normal file
View File

@@ -0,0 +1,81 @@
services:
db:
image: postgres:16
restart: unless-stopped
env_file:
- ${ENV_FILE:-.env}
environment:
POSTGRES_DB: ${DB_NAME:-app}
POSTGRES_USER: ${DB_USER:-app}
POSTGRES_PASSWORD: ${DB_PASS}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
start_period: 5s
migrate:
build: .
command: ["python", "-m", "core.migrations", "upgrade"]
environment:
DB_HOST: db
env_file:
- ${ENV_FILE:-.env}
depends_on:
db:
condition: service_healthy
restart: "no"
app:
build: .
restart: unless-stopped
init: true
ports:
- "8080:5000"
environment:
DB_HOST: db
env_file:
- ${ENV_FILE:-.env}
depends_on:
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/health/ready', timeout=3).read()"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
scheduler:
build: .
command: ["python", "-m", "scheduler.daemon"]
environment:
DB_HOST: db
restart: unless-stopped
init: true
env_file:
- ${ENV_FILE:-.env}
depends_on:
migrate:
condition: service_completed_successfully
bot:
build: .
command: ["python", "-m", "bot.bot"]
environment:
API_URL: http://app:5000
restart: unless-stopped
init: true
env_file:
- ${ENV_FILE:-.env}
depends_on:
app:
condition: service_healthy
volumes:
pgdata: