fastapi-sqlalchemy-asyncpg/docker-compose.yml
2021-04-19 13:04:37 +02:00

46 lines
840 B
YAML

version: '3'
services:
app:
build: .
env_file:
- .env
- .secrets
command: bash -c "
uvicorn the_app.main:app
--host 0.0.0.0 --port 8080
--lifespan=on --use-colors --loop uvloop --http httptools
--reload --reload-dir /app
"
volumes:
- .:/app
ports:
- 8080:8080
depends_on:
db:
condition: service_healthy
db:
build:
context: ./db
dockerfile: Dockerfile
volumes:
- postgres_data:/var/lib/postgresql/data
env_file:
- .env
- .secrets
ports:
- 5432:5432
environment:
- POSTGRES_USER=${SQL_USER}
healthcheck:
test:
[
"CMD-SHELL", "pg_isready -d $SQL_DB -U $SQL_USER"
]
interval: 5s
timeout: 5s
retries: 5
volumes:
postgres_data: