-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcheck.Containerfile
100 lines (66 loc) · 2.08 KB
/
check.Containerfile
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
################################################################################
## START : EDIT HERE : START ##
################################################################################
ARG rust_ver="1.84-slim"
################################################################################
## END : EDIT HERE : END ##
################################################################################
FROM docker.io/library/rust:${rust_ver:?} AS builder
USER 0:0
RUN ["mkdir", "-m", "0775", "/code/"]
RUN ["mkdir", "-m", "01557", "/build/"]
RUN ["chmod", "01777", "/tmp/"]
RUN ["chmod", "-R", "01557", "/usr/local/cargo/"]
ENV CARGO_TARGET_DIR="/build/target/"
RUN ["apt", "update"]
RUN ["apt", "upgrade", "--yes"]
RUN ["apt", "install", "--yes", "gcc", "libssl-dev", "pkg-config"]
USER 1000:1000
FROM builder AS cargo-audit
RUN ["cargo", "install", "--jobs", "1", "--force", "cargo-audit"]
FROM builder AS cargo-each
RUN \
--mount=type=bind,source="./tools/",target="/code/" \
[ \
"cargo", \
"install", \
"--jobs", "1", \
"--force", \
"--path", "/code/cargo-each/" \
]
FROM builder AS cargo-udeps
RUN ["cargo", "install", "--jobs", "1", "--force", "cargo-udeps"]
FROM builder
USER 0:0
RUN ["rustup", "component", "add", "clippy", "rustfmt"]
RUN ["rustup", "target", "add", "wasm32-unknown-unknown"]
RUN ["rustup", "toolchain", "add", "nightly"]
USER 1000:1000
ENTRYPOINT ["/check.sh"]
COPY \
--chmod="0555" \
--chown=0:0 \
--from=cargo-audit \
"/usr/local/cargo/bin/" \
"/usr/local/cargo/bin/"
COPY \
--chmod="0555" \
--chown=0:0 \
--from=cargo-each \
"/usr/local/cargo/bin/" \
"/usr/local/cargo/bin/"
COPY \
--chmod="0555" \
--chown=0:0 \
--from=cargo-udeps \
"/usr/local/cargo/bin/" \
"/usr/local/cargo/bin/"
COPY \
--chmod="0555" \
--chown=0:0 \
"./scripts/check/*.sh" \
"/"
USER 0:0
VOLUME ["/code/"]
RUN ["chmod", "-R", "0555", "/code/"]
USER 1000:1000