Skip to content

Commit 4b55c59

Browse files
committed
feat: change entrypoint to cmd to simplify CI usage
1 parent 876c5e7 commit 4b55c59

3 files changed

Lines changed: 25 additions & 23 deletions

File tree

.github/workflows/docker.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
base_image: alpine:3.20
2525
rust_target_suffix: musl
2626
tag_suffix: alpine-3.20
27+
- variant: scratch
28+
base_image: scratch
29+
rust_target_suffix: musl
30+
tag_suffix: scratch
2731
- variant: debian
2832
base_image: debian:trixie
2933
rust_target_suffix: gnu
@@ -88,4 +92,4 @@ jobs:
8892
BASE_IMAGE=${{ matrix.base_image }}
8993
RUST_TARGET_SUFFIX=${{ matrix.rust_target_suffix }}
9094
tags: ${{ steps.meta.outputs.tags }}
91-
labels: ${{ steps.meta.outputs.labels }}
95+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile.release

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,20 @@
22
ARG ALPINE_VERSION=3.20
33
ARG BASE_IMAGE=alpine:${ALPINE_VERSION}
44

5-
FROM ${BASE_IMAGE}
5+
FROM alpine:${ALPINE_VERSION} AS prep
66
ARG TARGETPLATFORM
77
ARG 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
198
COPY 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
269
RUN 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"]

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ docker run --rm -v "$PWD":/work -w /work tilaven/diff-coverage:<version>-debian-
8686
coverage.xml --diff-file diff.diff
8787
```
8888

89+
Minimal scratch image is available via versioned tags:
90+
91+
```bash
92+
docker run --rm -v "$PWD":/work -w /work tilaven/diff-coverage:<version>-scratch \
93+
coverage.xml --diff-file diff.diff
94+
```
95+
8996
## Build
9097

9198
```bash

0 commit comments

Comments
 (0)