-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdocker-compose.yaml
50 lines (48 loc) · 1.24 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
services:
web_app_db_pg:
env_file:
- .env
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
container_name: ${POSTGRES_HOST}
image: postgres:16-alpine
shm_size: 128mb
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
web_app:
build:
context: .
dockerfile: Dockerfile
image: web_app:latest
env_file:
- .env
environment:
PYTHONPATH: "/app/src"
UVICORN_HOST: ${UVICORN_HOST}
UVICORN_PORT: ${UVICORN_PORT}
ports:
- "${UVICORN_PORT}:${UVICORN_PORT}"
depends_on:
web_app_db_pg:
condition: service_healthy
command: >
sh -c "
echo 'Running alembic migrations...' &&
alembic upgrade head &&
echo 'Starting Uvicorn...' &&
uvicorn app.run:make_app --host ${UVICORN_HOST} --port ${UVICORN_PORT} --loop uvloop
"
volumes:
pgdata: