Add Docker support with Gunicorn, SQLite volume persistence, and optional PostgreSQL
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
53
docker-compose.yml
Normal file
53
docker-compose.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
services:
|
||||
accounting-backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: funzone_accounting_backend
|
||||
ports:
|
||||
- "127.0.0.1:8010:8010"
|
||||
environment:
|
||||
SECRET_KEY: ${SECRET_KEY:-your-super-secret-key-change-in-production}
|
||||
DEBUG: ${DEBUG:-False}
|
||||
ALLOWED_HOSTS: ${ALLOWED_HOSTS:-localhost,127.0.0.1,accounting-backend}
|
||||
CORS_ALLOW_ALL_ORIGINS: ${CORS_ALLOW_ALL_ORIGINS:-True}
|
||||
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3006,http://localhost:5176,http://127.0.0.1:3006,http://127.0.0.1:5176}
|
||||
SQLITE_PATH: /data/db.sqlite3
|
||||
DATABASE_URL: ${DATABASE_URL:-}
|
||||
DB_HOST: accounting-db
|
||||
POSTGRES_USER: ${POSTGRES_USER:-accounting_user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-accounting_password}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-accounting_db}
|
||||
volumes:
|
||||
- accounting_sqlite:/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8010/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
start_period: 40s
|
||||
retries: 3
|
||||
|
||||
accounting-db:
|
||||
image: postgres:16-alpine
|
||||
container_name: funzone_accounting_postgres
|
||||
profiles:
|
||||
- postgres
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-accounting_db}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-accounting_user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-accounting_password}
|
||||
volumes:
|
||||
- accounting_postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "127.0.0.1:5434:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-accounting_user} -d ${POSTGRES_DB:-accounting_db}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
accounting_sqlite:
|
||||
accounting_postgres:
|
||||
Reference in New Issue
Block a user