Commit b8b9d02
authored
Dockerfile, bin(run-tests), tests: set USER (#61)
Better conform with Dockerfile best practices [1]:
If a service can run without privileges, use `USER` to change to a
non-root user.
See also the Docker docs on `USER` [2], and the Alpine Linux wiki page
on creating a new user [3].
The commit [4] that added a zig cache significantly speeds up a
`RUN zig test foo` command that's added at the bottom of the Dockerfile.
But it doesn't seem to be a speedup in production.
I suspect that the zig cache isn't found in production, due to
differences in how containers are run (see Exercism's terraform and
tooling-invoker repos [5][6]).
I suspect that this commit may be insufficient to fix the problem, but
it's a step in the right direction. Possible follow-up work includes:
- Setting zig cache environment variables, or passing zig cache
location options to `zig test`
- Changing the paths of solution files.
- Updating Zig. I saw a recent commit [7] that touches Cache.zig.
Closes: #60
Closes: #62
Refs: #63
[1] https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
[2] https://docs.docker.com/engine/reference/builder/#user
[3] https://wiki.alpinelinux.org/wiki/Setting_up_a_new_user
[4] 82b56af, 2023-08-23, ".dockerignore, Dockerfile: add a zig cache"
[5] https://github.com/exercism/terraform/blob/3ff7b3b5a2f6/terraform/tooling_invoker/ami.sh#L68-L88
[6] https://github.com/exercism/tooling-invoker/blob/88a9d826a746/lib/tooling_invoker/job_processor/exec_docker.rb#L150-L162
[7] ziglang/zig@020105d0dde6
2023-08-20, "Cache: Fix findPrefix when paths are slightly out of the ordinary"1 parent ae6ae53 commit b8b9d02
4 files changed
Lines changed: 16 additions & 8 deletions
File tree
- bin
- tests
- example-all-fail
- example-partial-fail
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | | - | |
| 42 | + | |
40 | 43 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | | - | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
| |||
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | | - | |
37 | | - | |
38 | 42 | | |
39 | 43 | | |
| 44 | + | |
40 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
0 commit comments