Skip to content

Commit 29944e5

Browse files
AchoArnoldCopilot
andcommitted
feat(tests): add docker-compose for integration test stack
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent dd213fb commit 29944e5

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

tests/docker-compose.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
services:
2+
postgres:
3+
image: postgres:alpine
4+
environment:
5+
POSTGRES_DB: httpsms
6+
POSTGRES_PASSWORD: dbpassword
7+
POSTGRES_USER: dbusername
8+
ports:
9+
- "5435:5432"
10+
healthcheck:
11+
test: ["CMD-SHELL", "pg_isready -U dbusername -d httpsms"]
12+
interval: 5s
13+
timeout: 5s
14+
retries: 10
15+
start_period: 5s
16+
17+
redis:
18+
image: redis:latest
19+
command: redis-server
20+
ports:
21+
- "6379:6379"
22+
healthcheck:
23+
test: ["CMD", "redis-cli", "ping"]
24+
interval: 5s
25+
timeout: 5s
26+
retries: 10
27+
28+
emulator:
29+
build:
30+
context: ./emulator
31+
ports:
32+
- "9090:9090"
33+
environment:
34+
API_BASE_URL: http://api:8000
35+
PHONE_API_KEY: pk_test-phone-api-key
36+
PORT: "9090"
37+
healthcheck:
38+
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/health"]
39+
interval: 5s
40+
timeout: 5s
41+
retries: 10
42+
43+
api:
44+
build:
45+
context: ../api
46+
ports:
47+
- "8000:8000"
48+
depends_on:
49+
postgres:
50+
condition: service_healthy
51+
redis:
52+
condition: service_healthy
53+
emulator:
54+
condition: service_healthy
55+
env_file:
56+
- .env.test
57+
environment:
58+
FIREBASE_CREDENTIALS: "${FIREBASE_CREDENTIALS}"
59+
healthcheck:
60+
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8000/"]
61+
interval: 5s
62+
timeout: 10s
63+
retries: 20
64+
start_period: 30s
65+
66+
seed:
67+
image: postgres:alpine
68+
depends_on:
69+
api:
70+
condition: service_healthy
71+
environment:
72+
PGPASSWORD: dbpassword
73+
volumes:
74+
- ./seed.sql:/seed.sql:ro
75+
entrypoint:
76+
[
77+
"psql",
78+
"-h",
79+
"postgres",
80+
"-U",
81+
"dbusername",
82+
"-d",
83+
"httpsms",
84+
"-f",
85+
"/seed.sql",
86+
]
87+
restart: "no"

0 commit comments

Comments
 (0)