-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
191 lines (178 loc) · 5.25 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# SPDX-FileCopyrightText: 2023 HH Partners
#
# SPDX-License-Identifier: MIT
version: "3"
services:
postgres:
image: postgres:17.4
volumes:
- db-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7.4
volumes:
- redis-data:/data
command: /bin/sh -c "redis-server --requirepass redis"
ports:
- 6379:6379
restart: always
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 5s
timeout: 5s
retries: 5
minio:
image: minio/minio
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio-data:/data
environment:
MINIO_ROOT_USER: miniouser
MINIO_ROOT_PASSWORD: miniopassword
command: server --console-address ":9001" /data
restart: always
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 1s
timeout: 1s
retries: 20
createbuckets:
image: minio/mc
depends_on:
minio:
condition: service_healthy
required: true
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set myminio http://minio:9000 miniouser miniopassword;
/usr/bin/mc mb myminio/doubleopen;
exit 0;
"
run-migrations:
build:
dockerfile: API.Dockerfile
command: ["run", "db:migrate:deploy"]
environment:
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
depends_on:
postgres:
condition: service_healthy
required: true
keycloak:
image: quay.io/keycloak/keycloak:26.2.2
command: start-dev
ports:
- "8083:8080"
environment:
- KC_BOOTSTRAP_ADMIN_USERNAME=keycloak-admin
- KC_BOOTSTRAP_ADMIN_PASSWORD=keycloak-admin
healthcheck:
test: timeout 10s bash -c ':> /dev/tcp/localhost/8080'
interval: 10s
timeout: 5s
retries: 20
terraform:
build:
context: ./terraform
working_dir: /workspace
volumes:
- ./terraform:/workspace
depends_on:
keycloak:
condition: service_healthy
entrypoint: ["/bin/sh", "-c"]
command: >
"terraform init &&
terraform apply -auto-approve"
api:
build:
dockerfile: API.Dockerfile
ports:
- 3001:3001
environment:
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
- KEYCLOAK_URL=http://keycloak:8080
- ALLOWED_ORIGINS=http://clearance-ui:3000
- SPACES_ENDPOINT=http://minio:9000
- REDIS_URL=redis://redis:6379
- PORT=3001
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
interval: 30s
timeout: 10s
retries: 5
depends_on:
postgres:
condition: service_healthy
required: true
run-migrations:
condition: service_completed_successfully
required: true
redis:
condition: service_healthy
required: true
minio:
condition: service_healthy
required: true
keycloak:
condition: service_healthy
required: true
terraform:
condition: service_completed_successfully
required: true
scanner-worker:
build:
dockerfile: Worker.Dockerfile
environment:
- REDIS_URL=redis://redis:6379
- SPACES_ENDPOINT=http://minio:9000
- DEBUG=true
depends_on:
- redis
- minio
clearance-ui:
build:
dockerfile: UI.Dockerfile
args:
- NEXT_PUBLIC_API_URL=http://api:3001/api/
environment:
- NEXTAUTH_URL=http://clearance-ui:3000
- NEXTAUTH_SECRET=$NEXTAUTH_SECRET
- KEYCLOAK_URL=http://keycloak:8080
ports:
- 3002:3000
playwright-tests:
build:
context: .
dockerfile: Playwright.Dockerfile
args:
- NEXT_PUBLIC_API_URL=http://api:3001/api/
environment:
- KEYCLOAK_URL=http://keycloak:8080
- CI=true
depends_on:
api:
condition: service_healthy
clearance-ui:
condition: service_started
volumes:
- ./playwright-artifacts/clearance_ui:/workspace/apps/clearance_ui/playwright-report
volumes:
db-data:
driver: local
redis-data:
driver: local
minio-data:
driver: local