44 lines
854 B
YAML
44 lines
854 B
YAML
version: "3"
|
|
|
|
services:
|
|
db:
|
|
image: "postgres:latest"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
environment:
|
|
POSTGRES_USER: flaskuser
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_DB: flaskdb
|
|
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U flaskuser -d flaskdb"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
ports:
|
|
- "5432:5432"
|
|
|
|
web:
|
|
build: .
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
ports:
|
|
- "5001:5001"
|
|
environment:
|
|
- FLASK_ENV=production
|
|
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY}
|
|
- DB_PASSWORD=${DB_PASSWORD}
|
|
volumes:
|
|
- ./instance:/app/instance
|
|
command: sh -c "sleep 2 && flask init-db && gunicorn --bind 0.0.0.0:5001 --workers 4 app:app"
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
postgres_data:
|