-
Notifications
You must be signed in to change notification settings - Fork 19
/
docker-compose.yml
256 lines (241 loc) · 6.3 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
networks:
chalk:
gcp:
imds:
ipam:
driver: default
config:
- subnet: 169.254.169.0/24
services:
# --------------------------------------------------------------------------
# CHALK
chalk:
build:
context: .
target: deps
command: nimble ${CHALK_BUILD:-release}
working_dir: $PWD
volumes:
- $PWD:$PWD
- $PWD/../nimutils:$PWD/../nimutils
- $PWD/../con4m:$PWD/../con4m
environment:
DEBUG: ${DEBUG:-}
CHALK_PASSWORD: ${CHALK_PASSWORD:-}
# --------------------------------------------------------------------------
# SERVER
server:
build:
context: ./server
target: deps
networks:
chalk:
aliases:
- chalk.local
ports:
- 8585:8585
working_dir: /chalk/server
volumes:
- .:/chalk
environment:
REDIRECT: https://tls.chalk.local:5858
healthcheck:
test:
- CMD-SHELL
- sh -c "curl -f http://localhost:8585/health"
start_period: 30s
interval: 1s
server-tls:
build:
context: ./server
target: deps
command: run -r -p 5858 --domain=tls.chalk.local --keyfile=cert.key --certfile=cert.pem --use-existing-cert
working_dir: /chalk/server
volumes:
- .:/chalk
ports:
- 5858:5858
networks:
chalk:
aliases:
- tls.chalk.local
healthcheck:
test:
- CMD-SHELL
- sh -c "curl -f https://localhost:5858/health --insecure"
start_period: 30s
interval: 1s
# --------------------------------------------------------------------------
# TESTS
# there is no official imds test container so we have very simple wrapper
imds:
build:
context: ./tests/functional
entrypoint: uvicorn
command: app:app --host=0.0.0.0 --port=80 --reload
working_dir: /imds
volumes:
- ./tests/functional/imds:/imds
healthcheck:
test:
- CMD-SHELL
- sh -c "curl -f http://localhost/health"
start_period: 10s
interval: 1s
networks:
imds:
ipv4_address: 169.254.169.254
gcp:
# XXX for simplicity's sake, use a single imds app server for all
# of AWS, Azure, GCP
aliases:
- metadata.google.internal
# simple server for serving static files
static:
build:
context: ./tests/functional
entrypoint: python
command: -m http.server 8000
working_dir: /chalk/tests/functional
volumes:
- .:/chalk
healthcheck:
test:
- CMD-SHELL
- sh -c "curl -f http://localhost:8000/conftest.py"
start_period: 10s
interval: 1s
networks:
chalk:
tests:
build:
context: ./tests/functional
args:
BASE: ${BASE:-ubuntu}
entrypoint: $PWD/tests/functional/entrypoint.sh
cap_add:
- SYS_PTRACE # for gdb
security_opt:
- seccomp=unconfined # for gdb
volumes:
- $PWD:$PWD
- $HOME/.pdbrc.py:/root/.pdbrc.py
- /var/run/docker.sock:/var/run/docker.sock
- /etc/docker/certs.d:/etc/docker/certs.d
- /etc/buildkit:/etc/buildkit
- /etc/docker:/etc/docker
- /tmp:/tmp
working_dir: $PWD/tests/functional
networks:
- chalk
- imds
- gcp
depends_on:
registry:
condition: service_healthy
registry-tls:
condition: service_healthy
registry-tls-insecure:
condition: service_healthy
registry-proxy:
condition: service_healthy
server:
condition: service_healthy
server-tls:
condition: service_healthy
imds:
condition: service_healthy
environment:
AWS_REGION: ${AWS_REGION:-us-east-1}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
AWS_PROFILE: ${AWS_PROFILE:-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
DOCKER_GIT_CONTEXT_SSH_REPO: ${DOCKER_GIT_CONTEXT_SSH_REPO:-}
DOCKER_GIT_CONTEXT_TOKEN_REPO: ${DOCKER_GIT_CONTEXT_TOKEN_REPO:-}
GITHUB_ACTIONS: ${GITHUB_ACTIONS:-}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
IP: ${IP:-} # host IP for docker registry tests
SSH_KEY: ${SSH_KEY:-}
# --------------------------------------------------------------------------
# MISC DEPS
registry:
image: registry:2
ports:
- "5044:5044"
environment:
- REGISTRY_HTTP_ADDR=0.0.0.0:5044
networks:
- chalk
healthcheck:
test:
- CMD-SHELL
- sh -c "echo 'GET / HTTP/1.1' | nc -v localhost 5044"
start_period: 30s
interval: 1s
registry-tls:
image: registry:2
ports:
- "5045:5045"
volumes:
- /etc/docker/certs.d:/etc/docker/certs.d
- /etc/docker/keys:/etc/docker/keys
environment:
REGISTRY_HTTP_ADDR: 0.0.0.0:5045
REGISTRY_HTTP_TLS_CERTIFICATE: /etc/docker/certs.d/${IP:-127.0.0.1}:5045/ca.crt
REGISTRY_HTTP_TLS_KEY: /etc/docker/keys/${IP:-127.0.0.1}:5045/ca.key
networks:
- chalk
healthcheck:
test:
- CMD-SHELL
- sh -c "echo 'GET / HTTP/1.1' | nc -v localhost 5045"
start_period: 30s
interval: 1s
registry-tls-insecure:
image: registry:2
ports:
- "5046:5046"
volumes:
- /etc/docker/certs.d:/etc/docker/certs.d
- /etc/docker/keys:/etc/docker/keys
environment:
REGISTRY_HTTP_ADDR: 0.0.0.0:5046
REGISTRY_HTTP_TLS_CERTIFICATE: /etc/docker/certs.d/${IP:-127.0.0.1}:5044/ca.crt
REGISTRY_HTTP_TLS_KEY: /etc/docker/keys/${IP:-127.0.0.1}:5044/ca.key
networks:
- chalk
healthcheck:
test:
- CMD-SHELL
- sh -c "echo 'GET / HTTP/1.1' | nc -v localhost 5046"
start_period: 30s
interval: 1s
registry-proxy:
image: registry:2
ports:
- "5047:5047"
environment:
- REGISTRY_HTTP_ADDR=0.0.0.0:5047
- REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io
networks:
- chalk
healthcheck:
test:
- CMD-SHELL
- sh -c "echo 'GET / HTTP/1.1' | nc -v localhost 5047"
start_period: 30s
interval: 1s
sqlite:
image: coleifer/sqlite-web
volumes:
- ./server:/server
environment:
SQLITE_DATABASE: /server/chalkdb.sqlite
ports:
- 18080:8080
healthcheck:
test:
- CMD-SHELL
- sh -c "echo 'GET / HTTP/1.1' | nc -v localhost 8080"
start_period: 30s
interval: 1s