-
Notifications
You must be signed in to change notification settings - Fork 233
Expand file tree
/
Copy pathMakefile
More file actions
398 lines (326 loc) · 14.3 KB
/
Makefile
File metadata and controls
398 lines (326 loc) · 14.3 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
BUILDX_OUTPUT ?= --load
compose:
docker compose up app
compose-d:
docker compose up -d app
compose-build:
docker compose build --build-arg GIT_HASH=$(shell git rev-parse HEAD) app
compose-down:
docker compose down -v || true
compose-test-code-checkers:
docker compose run --rm --name codebattle_app app mix test image_executor
compose-test-fe:
docker compose run --rm --name codebattle_app app /bin/sh -c 'cd /app/apps/codebattle && pnpm test'
compose-test:
docker compose run --rm --name codebattle_app app mix test --exclude image_executor
compose-kill:
docker compose kill
compose-bash:
docker compose run app bash
compose-install-mix:
docker compose run --rm --name codebattle_app app mix deps.get
compose-install-pnpm:
docker compose run --rm --name codebattle_app app /bin/sh -c 'cd /app/apps/codebattle && pnpm install && pnpm run build:mem'
compose-install: compose-install-mix compose-install-pnpm
compose-setup: compose-down compose-build compose-install compose-db-setup
compose-db-setup:
docker compose run --rm --name codebattle_app app mix ecto.setup
compose-db-migrate:
docker compose run --rm --name codebattle_app app mix ecto.migrate
compose-lint: compose-mix-format compose-mix-credo compose-lint-js-fix
compose-mix-format:
docker compose run --rm --name codebattle_app app mix format
compose-mix-credo:
docker compose run app mix credo
compose-lint-js-fix:
docker compose run --rm --name codebattle_app app /bin/sh -c 'cd /app/apps/codebattle && pnpm run lint --fix'
compose-console:
docker compose run --rm --name codebattle_app app iex -S mix
compose-restart:
docker compose restart
compose-stop:
docker compose stop
compose-logs:
docker compose logs -f --tail=100
compose-compile:
docker compose run --rm --name codebattle_app app mix compile
compose-build-images:
docker compose run --rm --name codebattle_app app mix images.build ${lang}
compose-pull-images:
docker compose run --rm --name codebattle_app app mix images.pull ${lang}
compose-push-images:
docker compose run --rm --name codebattle_app app mix images.push ${lang}
pg:
docker compose up -d db-local
clean:
rm -rf _build
rm -rf deps
rm -rf .elixir_ls
rm -rf priv/static
rm -rf node_modules
format:
mix format
lint:
mix format --check-formatted
credo:
mix credo
db-recreate:
mix cmd --app codebattle mix ecto.reset
outdated:
mix hex.outdated
lint-js:
cd apps/codebattle && pnpm run lint
lint-js-fix:
cd apps/codebattle && pnpm run lint-fix
start:
bin/codebattle eval "Codebattle.Utils.Release.migrate"
bin/codebattle start
runner-start:
bin/runner start
server:
iex -S mix phx.server
console:
iex -S mix
test:
mix coveralls.json --exclude image_executor --max-failures 1
dialyzer:
mix dialyzer
test-code-checkers: export CODEBATTLE_EXECUTOR = local
test-code-checkers:
mix test apps/codebattle/test/images --max-failures 10
terraform-vars-generate:
docker run --rm -it -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-playbook ansible/terraform.yml -i ansible/production -vv --vault-password-file=tmp/ansible-vault-password
setup: setup-env compose-setup
setup-env:
docker run --rm -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-playbook ansible/development.yml -i ansible/development -vv
setup-env-local:
ansible-playbook ansible/development.yml -i ansible/development -vv
ansible-edit-secrets:
ansible-vault edit --vault-password-file tmp/ansible-vault-password ansible/production/group_vars/all/vault.yml
ansible-vault-edit-production:
docker run --rm -it -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-vault edit --vault-password-file tmp/ansible-vault-password ansible/production/group_vars/all/vault.yml
release:
mix release
build-local:
DOCKER_BUILDKIT=1 docker build --target assets-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image \
--tag ghcr.io/hexlet-codebattle/codebattle:assets-image .
DOCKER_BUILDKIT=1 docker build --target compile-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image \
--tag ghcr.io/hexlet-codebattle/codebattle:compile-image .
DOCKER_BUILDKIT=1 docker build --target nginx-assets \
--file Containerfile.codebattle \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image \
--cache-from ghcr.io/hexlet-codebattle/nginx-assets:latest \
--tag ghcr.io/hexlet-codebattle/nginx-assets:latest .
DOCKER_BUILDKIT=1 docker build --target runtime-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image \
--cache-from ghcr.io/hexlet-codebattle/codebattle:latest \
--tag ghcr.io/hexlet-codebattle/codebattle:latest .
DOCKER_BUILDKIT=1 docker build --target compile-image \
--file Containerfile.runner \
--cache-from ghcr.io/hexlet-codebattle/runner:compile-image \
--tag ghcr.io/hexlet-codebattle/runner:compile-image .
DOCKER_BUILDKIT=1 docker build --target runtime-image \
--file Containerfile.runner \
--cache-from ghcr.io/hexlet-codebattle/runner:compile-image \
--cache-from ghcr.io/hexlet-codebattle/runner:latest \
--tag ghcr.io/hexlet-codebattle/runner:latest .
build-codebattle:
docker pull ghcr.io/hexlet-codebattle/codebattle:assets-image || true
docker pull ghcr.io/hexlet-codebattle/codebattle:compile-image || true
docker pull ghcr.io/hexlet-codebattle/codebattle:latest || true
DOCKER_BUILDKIT=1 docker buildx build $(BUILDX_OUTPUT) --target assets-image \
--file Containerfile.codebattle \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:assets-cache \
$(if $(DISABLE_CACHE_EXPORT),,--cache-to type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:assets-cache,mode=max) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/codebattle:assets-image .
DOCKER_BUILDKIT=1 docker buildx build $(BUILDX_OUTPUT) --target compile-image \
--file Containerfile.codebattle \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:assets-cache \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:compile-cache \
$(if $(DISABLE_CACHE_EXPORT),,--cache-to type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:compile-cache,mode=max) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/codebattle:compile-image .
DOCKER_BUILDKIT=1 docker buildx build $(BUILDX_OUTPUT) --target nginx-assets \
--file Containerfile.codebattle \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:assets-cache \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:compile-cache \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/nginx-assets:buildcache \
$(if $(DISABLE_CACHE_EXPORT),,--cache-to type=registry,ref=ghcr.io/hexlet-codebattle/nginx-assets:buildcache,mode=max) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image \
--cache-from ghcr.io/hexlet-codebattle/nginx-assets:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/nginx-assets:latest .
DOCKER_BUILDKIT=1 docker buildx build $(BUILDX_OUTPUT) --target runtime-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:compile-cache \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:runtime-cache \
$(if $(DISABLE_CACHE_EXPORT),,--cache-to type=registry,ref=ghcr.io/hexlet-codebattle/codebattle:runtime-cache,mode=max) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image \
--cache-from ghcr.io/hexlet-codebattle/codebattle:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/codebattle:latest .
build-arm:
DOCKER_BUILDKIT=1 docker build --platform linux/arm64 \
--target assets-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image-arm \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/codebattle:assets-image-arm .
DOCKER_BUILDKIT=1 docker build --platform linux/arm64 \
--target compile-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image-arm \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image-arm \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/codebattle:compile-image-arm .
DOCKER_BUILDKIT=1 docker build --platform linux/arm64 \
--target nginx-assets \
--file Containerfile.codebattle \
--cache-from ghcr.io/hexlet-codebattle/codebattle:assets-image-arm \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image-arm \
--cache-from ghcr.io/hexlet-codebattle/nginx-assets:arm \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/nginx-assets:arm .
DOCKER_BUILDKIT=1 docker build --platform linux/arm64 \
--target runtime-image \
--file Containerfile.codebattle \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from ghcr.io/hexlet-codebattle/codebattle:compile-image-arm \
--cache-from ghcr.io/hexlet-codebattle/codebattle:arm \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/codebattle:arm .
push-codeabttle-arm:
docker push ghcr.io/hexlet-codebattle/codebattle:assets-image-arm
docker push ghcr.io/hexlet-codebattle/codebattle:compile-image-arm
docker push ghcr.io/hexlet-codebattle/codebattle:arm
docker push ghcr.io/hexlet-codebattle/nginx-assets:arm
push-codebattle:
docker push ghcr.io/hexlet-codebattle/codebattle:assets-image
docker push ghcr.io/hexlet-codebattle/codebattle:compile-image
docker push ghcr.io/hexlet-codebattle/codebattle:latest
docker push ghcr.io/hexlet-codebattle/nginx-assets:latest
build-runner:
docker pull ghcr.io/hexlet-codebattle/runner:compile-image || true
docker pull ghcr.io/hexlet-codebattle/runner:latest || true
DOCKER_BUILDKIT=1 docker buildx build $(BUILDX_OUTPUT) --target compile-image \
--file Containerfile.runner \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/runner:compile-cache \
$(if $(DISABLE_CACHE_EXPORT),,--cache-to type=registry,ref=ghcr.io/hexlet-codebattle/runner:compile-cache,mode=max) \
--cache-from ghcr.io/hexlet-codebattle/runner:compile-image \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/runner:compile-image .
DOCKER_BUILDKIT=1 docker buildx build $(BUILDX_OUTPUT) --target runtime-image \
--file Containerfile.runner \
--build-arg GIT_HASH=$(GIT_HASH) \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/runner:compile-cache \
--cache-from type=registry,ref=ghcr.io/hexlet-codebattle/runner:runtime-cache \
$(if $(DISABLE_CACHE_EXPORT),,--cache-to type=registry,ref=ghcr.io/hexlet-codebattle/runner:runtime-cache,mode=max) \
--cache-from ghcr.io/hexlet-codebattle/runner:compile-image \
--cache-from ghcr.io/hexlet-codebattle/runner:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ghcr.io/hexlet-codebattle/runner:latest .
push-runner:
docker push ghcr.io/hexlet-codebattle/runner:compile-image
docker push ghcr.io/hexlet-codebattle/runner:latest
runner-ruby:
docker run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/ruby:4.0.1
runner-cpp:
docker run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/cpp:23
runner-swift:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/swift:6.2.3
runner-kotlin:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/kotlin:2.3.0
runner-js:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/js:25.4.0
runner-dart:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/dart:3.10.0
runner-csharp:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/csharp:10.0.102
runner-clojure:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/clojure:1.12.4
runner-elixir:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/elixir:1.19.5
runner-golang:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/golang:1.25.6
runner-php:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/php:8.5.2
runner-java:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/java:25.0.2
runner-zig:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/zig:0.15.2
runner-rust:
podman run --rm -p 4040:4040 \
--cap-add=SYS_ADMIN \
--cap-add=SYS_CHROOT \
--security-opt=no-new-privileges=false \
ghcr.io/hexlet-codebattle/rust:1.93.0