-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
50 lines (48 loc) · 1.26 KB
/
Copy pathcompose.yaml
File metadata and controls
50 lines (48 loc) · 1.26 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
services:
database:
image: postgres:17-alpine
ports:
- "127.0.0.1:${POSTGRES_PORT:-5432}:5432"
environment:
POSTGRES_DB: inventory
POSTGRES_USER: inventory
POSTGRES_PASSWORD: inventory
healthcheck:
test: ["CMD", "pg_isready", "--username=inventory", "--dbname=inventory"]
interval: 2s
timeout: 5s
retries: 15
start_period: 5s
volumes:
- database-data:/var/lib/postgresql/data
api:
image: inventory-api:milestone-2
build:
context: .
platform: linux/amd64
environment:
DATABASE_URL: postgresql://inventory:inventory@database:5432/inventory?schema=public
PORT: 3000
APP_PREVIEW_KEY: "${APP_PREVIEW_KEY:?APP_PREVIEW_KEY is required}"
JWT_SECRET: "${JWT_SECRET:?JWT_SECRET is required}"
depends_on:
database:
condition: service_healthy
healthcheck:
test:
- CMD
- node
- --input-type=module
- --eval
- >-
const response = await fetch('http://127.0.0.1:3000/health');
if (!response.ok) process.exit(1);
interval: 2s
timeout: 5s
retries: 15
start_period: 5s
ports:
- "${HTTP_PORT:-3000}:3000"
stop_grace_period: 15s
volumes:
database-data: