Add Docker support

- Dockerfile: multi-stage Python 3.12 slim build
- docker-compose.yml: app + PostgreSQL 16 with healthcheck
- requirements.txt: fastapi, uvicorn, psycopg, passlib, jose
- .dockerignore: exclude venv, pycache, secrets
- app.py: env-based DB config (DB_HOST/PORT/NAME/USER/PASSWORD)
- README: Docker deploy instructions
This commit is contained in:
Jetour BI
2026-06-18 20:47:23 +00:00
parent 9ff9ec27e9
commit 3f6824d86c
7 changed files with 153 additions and 3 deletions

View File

@@ -76,3 +76,45 @@ Migrations are tracked in the `_migrations` table. Safe to run repeatedly.
| Monthly Report | 1st 07:00 | `POST /api/send-report/monthly` |
Dashboard handles all SMTP send + recipient resolution.
## Docker Deployment
```bash
# Build and start (app + PostgreSQL)
docker compose up -d
# Set a custom DB password
DB_PASSWORD=mysecretpassword docker compose up -d
# View logs
docker compose logs -f app
# Stop
docker compose down
# Reset (destroy DB volume)
docker compose down -v
```
### Environment variables
| Variable | Default | Description |
|----------|---------|-------------|
| `DB_HOST` | `db` | PostgreSQL host |
| `DB_PORT` | `5432` | PostgreSQL port |
| `DB_NAME` | `jetour-bi` | Database name |
| `DB_USER` | `jetour` | Database user |
| `DB_PASSWORD` | `jetour` | Database password |
| `JWT_SECRET` | `change-me-in-production` | JWT signing secret |
| `SMTP_HOST` | (empty) | SMTP server for email reports |
| `SMTP_PORT` | `587` | SMTP port |
| `SMTP_USER` | (empty) | SMTP username |
| `SMTP_PASS` | (empty) | SMTP password |
| `SMTP_FROM` | `reports@jetour.mu` | From address |
### Ports
| Service | Port | Description |
|---------|------|-------------|
| Dashboard | `8765` | Web UI |
| PostgreSQL | `5433` | Mapped from container `5432` |