-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
78 lines (74 loc) · 2.59 KB
/
Copy pathdocker-compose.yml
File metadata and controls
78 lines (74 loc) · 2.59 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
# Local development. This file does not describe production: production is a container
# image on Cloud Run plus a bucket (ADR 0004).
#
# Persistence is Postgres (ADR 0006), so the stack runs one: production is Neon, and
# developing against the same engine is the whole point. Shelf photos are ephemeral and never
# stored (ADR 0006), so the stack carries no object storage.
#
# The Dockerfiles live in docker/ and take the repository root as their build context.
services:
api:
build:
context: .
dockerfile: docker/api.Dockerfile
environment:
NODE_ENV: development
PORT: '3000'
# Local stand-in for the Neon endpoint; production reads this same variable from
# Secret Manager.
DATABASE_URL: postgresql://pick_a_book:pick_a_book@db:5432/pick_a_book
# Defaults to the stub, so the stack comes up without any provider key. Export the
# variables in your shell (or .env) to point it at a real VLM.
SHELF_SCANNER_PROVIDER: ${SHELF_SCANNER_PROVIDER:-stub}
GEMINI_API_KEY: ${GEMINI_API_KEY:-}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
ports:
- '3000:3000'
depends_on:
db:
condition: service_healthy
healthcheck:
test:
[
'CMD',
'node',
'-e',
"fetch('http://localhost:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
web:
build:
context: .
dockerfile: docker/web.Dockerfile
ports:
- '4200:4200'
depends_on:
- api
# Stands in for Neon (ADR 0006). The major version is pinned here only: `infra/modules/neon`
# creates the project without `pg_version` and takes Neon's default, so the two pins are
# maintained by hand — same arrangement as the Node pins of docker/.
db:
image: postgres:17.6-alpine
environment:
POSTGRES_USER: pick_a_book
POSTGRES_PASSWORD: pick_a_book
POSTGRES_DB: pick_a_book
# Published on 5433, not 5432: `yarn api` runs on the host and needs to reach this
# database, but the default port would collide with a Postgres already installed there.
# Inside the compose network the API still talks to `db:5432` — only the host side moves,
# so `.env.example` carries 5433 and has to move with it.
ports:
- '5433:5432'
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U pick_a_book -d pick_a_book']
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
volumes:
db-data: