-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
81 lines (77 loc) · 2.14 KB
/
compose.yaml
File metadata and controls
81 lines (77 loc) · 2.14 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: chatbot-bd
services:
database:
image: postgres:13-alpine
env_file: .env
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
# Use host port 5433 because port 5432
# may already be in use by our website backend
- 5433:5432
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 30s
timeout: 5s
start_period: 30s
start_interval: 5s
container_name: chatbot-database
migration:
build: .
command: ./scripts/migrate.sh
env_file: .env
depends_on:
database:
condition: service_healthy
restart: true
container_name: chatbot-migration
chatbot-api:
build: .
command: uvicorn app.main:app --host 0.0.0.0 --reload
env_file: .env
environment:
# Enable dev dependencies for local development
- UV_NO_DEV=0
depends_on:
database:
condition: service_healthy
restart: true
# Run database migrations before starting the API
migration:
condition: service_completed_successfully
develop:
# Live-reload configuration for local development
# Ref: https://docs.docker.com/compose/how-tos/file-watch
watch:
# Sync the working directory with the `/app` directory in the container
- action: sync
path: .
target: /app
# Exclude the host virtual environment to avoid
# platform mismatches and invalid symlinks
ignore:
- .venv/
# Rebuild the image when dependencies change
- action: rebuild
path: ./uv.lock
ports:
- 8000:8000
volumes:
# Mount Google Cloud credentials (read-only)
- ${HOME}/.basedosdados/credentials:/app/credentials:ro
deploy:
# Limit local resources to match our pod resources
resources:
reservations:
cpus: '0.25'
memory: 1G
limits:
cpus: '0.5'
memory: 2G
container_name: chatbot-api
volumes:
pgdata: