-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
62 lines (57 loc) · 1.35 KB
/
docker-compose.yml
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
version: "3.8"
# startup order: database -> server -> client
# setup for local development to approximate prod (db is local image, final will be hosted on Heroku postgres)
volumes:
db-data:
name: db-data
services:
svelte-client:
container_name: frontend
build:
context: ./frontend
dockerfile: Dockerfile
restart: on-failure
ports:
- 5173:5173
env_file:
- ./frontend/.env
depends_on:
go-server:
condition: service_healthy
postgres-db:
condition: service_healthy
go-server:
container_name: backend
build:
context: ./backend
dockerfile: Dockerfile
restart: on-failure
ports:
- 8080:8080
env_file:
- ./backend/.env
healthcheck:
test: curl -f http://localhost:8080/api-health || exit 1
interval: 10s
timeout: 3s
retries: 3
depends_on:
postgres-db:
condition: service_healthy
postgres-db:
container_name: database
image: postgres:latest
restart: always
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
volumes:
- db-data:/var/lib/postgres/data/
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB'"]
interval: 10s
timeout: 3s
retries: 3