-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (41 loc) · 1.59 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (41 loc) · 1.59 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
FROM alpine:3.24.1
# Multi-architecture from buildx
ARG TARGETARCH
# GoogleContainerTools/container-structure-test
ARG CST_VERSION=v1.22.1
# Copy all needed files
COPY entrypoint.sh /
COPY alpine-packages.txt /tmp/alpine-packages.txt
# Install needed packages
SHELL ["/bin/ash", "-euxo", "pipefail", "-c"]
# hadolint ignore=DL3018
RUN set -eux; \
xargs -r apk add --no-cache < /tmp/alpine-packages.txt; \
chmod +x /entrypoint.sh; \
targetarch="${TARGETARCH:-}" ;\
if [ -z "${targetarch}" ]; then \
case "$(uname -m)" in \
x86_64) targetarch="amd64" ;; \
aarch64|arm64) targetarch="arm64" ;; \
*) echo "Unsupported host architecture: $(uname -m)"; exit 1 ;; \
esac ;\
fi ;\
case "${targetarch}" in amd64|arm64) ;; *) echo "Unsupported TARGETARCH: ${targetarch}"; exit 1 ;; esac ;\
binary="container-structure-test-linux-${targetarch}" ;\
base_url="https://github.com/GoogleContainerTools/container-structure-test/releases/download/${CST_VERSION}" ;\
curl -fsSL "${base_url}/checksums.txt" -o /tmp/checksums.txt ;\
curl -fsSL \
"${base_url}/${binary}" \
-o /usr/local/bin/container-structure-test ;\
expected_sha="$(awk -v b="${binary}" '$2==b {print $1}' /tmp/checksums.txt)" ;\
[ -n "${expected_sha}" ] ;\
actual_sha="$(sha256sum /usr/local/bin/container-structure-test | awk '{print $1}')" ;\
[ "${actual_sha}" = "${expected_sha}" ] ;\
chmod +x /usr/local/bin/container-structure-test ;\
rm -rf /var/cache/* ;\
rm -rf /root/.cache/* ;\
rm -rf /tmp/* ;\
container-structure-test version
# Finish up
WORKDIR /github/workspace
ENTRYPOINT ["/entrypoint.sh"]