mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
45 lines
854 B
YAML
45 lines
854 B
YAML
version: '3'
|
|
|
|
services:
|
|
app:
|
|
build: .
|
|
env_file:
|
|
- .env
|
|
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
|
|
ports:
|
|
- 5432:5432
|
|
environment:
|
|
- POSTGRES_USER=${SQL_USER}
|
|
- POSTGRES_PASSWORD=${SQL_PASS}
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD-SHELL", "pg_isready -d $POSTGRES_DB -U $POSTGRES_USER"
|
|
]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
volumes:
|
|
postgres_data: |