-
Notifications
You must be signed in to change notification settings - Fork 1
/
compose.yml
132 lines (126 loc) · 3.01 KB
/
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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
version: "3.3"
services:
backend-service:
container_name: backend-service
image: backend:latest
build:
context: .
dockerfile: Dockerfile
profiles:
- backend-service
ports:
- 80:8082
environment:
DB_ADDRESS: backend-db
DB_USER: root
DB_PASSWORD: root
REDIS_ADDRESS: backend-redis
PATH_CONF: ../config
FILE_CONF: local.conf
PATH_LOG: ./logs
command: ["./main", "false", "service.log", "run-service"]
healthcheck:
test:
[
"CMD",
"curl",
"-f",
"http://localhost:8082/api/v1/security/health/check",
]
interval: 5m
timeout: 5s
retries: 3
start_period: 15s
start_interval: 5s
depends_on:
backend-migration:
condition: service_healthy
backend-migration:
container_name: backend-migration
image: backend:latest
build:
context: .
dockerfile: Dockerfile
profiles:
- backend-migration
environment:
DB_ADDRESS: backend-db
DB_USER: root
DB_PASSWORD: root
REDIS_ADDRESS: backend-redis
PATH_CONF: ../config
FILE_CONF: local.conf
PATH_LOG: ./logs
command: sleep infinity
healthcheck:
test: ./main false service.log run-migration
interval: 5m
timeout: 5s
retries: 3
start_period: 5s
start_interval: 5s
depends_on:
backend-db:
condition: service_healthy
backend-redis:
condition: service_healthy
backend-db:
container_name: backend-db
image: mysql:8.0.33
command: --default-authentication-plugin=mysql_native_password
platform: linux/amd64
profiles:
- dependencies
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: backend-db
healthcheck:
test: mysql --user=root --password=root --execute='show databases'
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
start_interval: 5s
backend-redis:
container_name: backend-redis
image: redis:6.2.4
platform: linux/amd64
profiles:
- dependencies
ports:
- 6379:6379
healthcheck:
test: redis-cli ping
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
start_interval: 5s
backend-api-contract:
container_name: backend-api-contract
image: swaggerapi/swagger-ui
platform: linux/amd64
restart: always
volumes:
- ./docs/openapi:/openapi
ports:
- 5050:8080
environment:
SWAGGER_JSON: /openapi/swagger.yaml
integration-tests:
container_name: integration-tests
image: golang:1.21-alpine
profiles:
- integration-tests
command: sh -c "cd /go/src/backend && go test backend/tests/integration -v"
volumes:
- ./:/go/src/backend
environment:
SERVICE_ADDRESS: backend-service:8082
depends_on:
backend-service:
condition: service_healthy
backend-migration:
condition: service_healthy