22ARG ALPINE_VERSION=3.20
33ARG BASE_IMAGE=alpine:${ALPINE_VERSION}
44
5- FROM ${BASE_IMAGE}
5+ FROM alpine:${ALPINE_VERSION} AS prep
66ARG TARGETPLATFORM
77ARG RUST_TARGET_SUFFIX=musl
8- RUN set -eux; \
9- if command -v apk >/dev/null 2>&1; then \
10- apk add --no-cache ca-certificates; \
11- elif command -v apt-get >/dev/null 2>&1; then \
12- apt-get update; \
13- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates; \
14- rm -rf /var/lib/apt/lists/*; \
15- else \
16- echo "Unsupported base image: missing apk/apt-get" >&2; \
17- exit 1; \
18- fi
198COPY dist/ /dist/
20- RUN echo "TARGETPLATFORM=${TARGETPLATFORM}"
21- RUN case "$TARGETPLATFORM" in \
22- "linux/arm64") echo "aarch64-unknown-linux-${RUST_TARGET_SUFFIX}" > rust_target.txt ;; \
23- "linux/amd64") echo "x86_64-unknown-linux-${RUST_TARGET_SUFFIX}" > rust_target.txt ;; \
24- *) exit 1 ;; \
25- esac
269RUN set -eux; \
27- mv "/dist/diff-coverage-$(cat rust_target.txt)" /usr/local/bin/diff-coverage; \
28- chmod +x /usr/local/bin/diff-coverage; \
29- rm -rf /dist rust_target.txt
30- ENTRYPOINT ["diff-coverage"]
10+ mkdir -p /out; \
11+ case "$TARGETPLATFORM" in \
12+ "linux/arm64") target="aarch64-unknown-linux-${RUST_TARGET_SUFFIX}" ;; \
13+ "linux/amd64") target="x86_64-unknown-linux-${RUST_TARGET_SUFFIX}" ;; \
14+ *) echo "Unsupported TARGETPLATFORM=$TARGETPLATFORM" >&2; exit 1 ;; \
15+ esac; \
16+ mv "/dist/diff-coverage-${target}" /out/diff-coverage; \
17+ chmod +x /out/diff-coverage
18+
19+ FROM ${BASE_IMAGE}
20+ COPY --from=prep /out/diff-coverage /usr/local/bin/diff-coverage
21+ CMD ["/usr/local/bin/diff-coverage"]
0 commit comments