Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
55 lines (52 loc) · 1.6 KB
/
Copy pathcompose.yaml
File metadata and controls
55 lines (52 loc) · 1.6 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
services:
db:
# Postgres 18 with the pgvector extension, matching the version used on Neon
image: docker.io/pgvector/pgvector:0.8.7-pg18
environment:
POSTGRES_USER: cookable
POSTGRES_PASSWORD: cookable
POSTGRES_DB: cookable
ports:
# Exposed so tools like DBeaver or psql on the host can connect
- "5432:5432"
volumes:
# Postgres 18 images keep their data under /var/lib/postgresql/18
- cookable-db:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cookable -d cookable"]
interval: 5s
timeout: 3s
retries: 10
backend:
build: ./backend
# Apply pending migrations before starting the API (local only; in
# production migrations run as a separate deploy step)
command: sh -c "alembic upgrade head && exec uvicorn main:app --host 0.0.0.0 --port 8000"
env_file:
- path: ./backend/.env
required: false
environment:
DATABASE_URL: postgresql+psycopg://cookable:cookable@db:5432/cookable
CORS_ORIGINS: http://localhost:3000
ports:
- "8000:8000"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health')"]
interval: 30s
timeout: 3s
start_period: 10s
depends_on:
db:
condition: service_healthy
frontend:
build:
context: ./frontend
args:
# Called from the browser, so it must be reachable from the host
VITE_API_URL: http://localhost:8000/api/v1
ports:
- "3000:8080"
depends_on:
- backend
volumes:
cookable-db: