-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
37 lines (35 loc) · 950 Bytes
/
Copy pathdocker-compose.yml
File metadata and controls
37 lines (35 loc) · 950 Bytes
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
services:
# PostgreSQL database service
db:
image: postgres:15-alpine
container_name: task_manager_db
environment:
POSTGRES_USER: taskuser
POSTGRES_PASSWORD: taskpass
POSTGRES_DB: taskdb
ports:
- "5433:5432" # Use 5433 on host, 5432 inside container
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U taskuser -d taskdb"]
interval: 10s
timeout: 5s
retries: 5
# FastAPI application service
web:
build: .
container_name: task_manager_app
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
ports:
- "8001:8000" # Use 8001 on host, 8000 inside container
environment:
DATABASE_URL: postgresql+asyncpg://taskuser:taskpass@db:5432/taskdb
depends_on:
db:
condition: service_healthy
volumes:
- .:/app
restart: on-failure
volumes:
postgres_data: