-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
100 lines (91 loc) · 2.05 KB
/
docker-compose.yaml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
services:
gateway-service:
build:
context: .
dockerfile: "./docker/go-todo/Dockerfile"
expose:
- "8081"
environment:
HOST: "0.0.0.0"
PORT: "8081"
TASK_SERVER_ADDRESS: "task-service:9000"
command: ["gateway", "start"]
networks:
- go-todo-net
task-service:
build:
context: .
dockerfile: "./docker/go-todo/Dockerfile"
expose:
- "9000"
environment:
PORT: "9000"
APP_ENV: "development"
LOG_LEVEL: "0"
LOG_SAMPLE_RATE: "5"
DB_URL: "postgresql://postgres:postgres@task-db:5432/task?sslmode=disable"
command: ["task", "start"]
networks:
- go-todo-net
depends_on:
task-db:
condition: service_healthy
task-db:
image: postgres:16.2
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_DB: "task"
ports:
- "65433:5432"
networks:
- go-todo-net
healthcheck:
test: pg_isready -U postgres -d task
interval: 10s
timeout: 3s
retries: 5
task-migrate:
image: migrate/migrate
volumes:
- ./migrations:/migrations
command:
[
"-path=/migrations/task",
"-database=postgresql://postgres:postgres@task-db:5432/task?sslmode=disable",
"up",
]
networks:
- go-todo-net
depends_on:
task-db:
condition: service_healthy
nginx:
image: nginx:alpine
tty: true
ports:
- 80:80
- 443:443
volumes:
# nginx config
- ./docker/nginx:/etc/nginx/conf.d
restart: always
networks:
- go-todo-net
swagger-service:
image: swaggerapi/swagger-ui:latest
expose:
- "8080"
environment:
# Ref: https://github.com/swagger-api/swagger-ui/issues/4915#issuecomment-475755863
URLS: >
[
{ url: 'docs/task/v1/task.swagger.json', name: 'Go Todo Task API' }
]
volumes:
- ./api/openapi:/usr/share/nginx/html/docs/
networks:
- go-todo-net
networks:
go-todo-net:
driver: bridge