From 02ceb04147eff176be263726c87baaeb9cdd6a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 18 Dec 2022 16:11:59 +0200 Subject: [PATCH 1/3] fix: Use `bullseye-slim` as final Docker image base `rust:1.65.0` is based on Bullseye, and at time of writing the binary built on it does not work on Buster: ``` $ docker build -t typos . && docker run --rm -it typos typos -V typos: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by typos) ``` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a720f82..5c8bc4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,6 @@ WORKDIR /usr/src/typos COPY . . RUN cargo install --path . -FROM debian:buster-slim +FROM debian:bullseye-slim COPY --from=builder /usr/local/cargo/bin/typos /usr/local/bin/typos CMD ["typos"] From 57378424101a26dc270b3df6e3ed5c8988a203ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 18 Dec 2022 16:16:00 +0200 Subject: [PATCH 2/3] chore: Use `rust:bullseye` as Docker builder Use `bullseye` explicitly to make the correspondence with the final image clear, and remove explicit Rust version as it does not seem that important, and the final runtime image version is what it is at the time too. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5c8bc4d..7db315d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.65.0 as builder +FROM rust:bullseye as builder WORKDIR /usr/src/typos COPY . . RUN cargo install --path . From 7f0e8c72953bf5f5169514296fd8d3ec90557d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 18 Dec 2022 16:18:31 +0200 Subject: [PATCH 3/3] chore: Make Debian dist a Docker build argument Makes it overridable from CLI, and just one place to update. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7db315d..47fe91a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ -FROM rust:bullseye as builder +ARG DEBIAN_DIST=bullseye + +FROM rust:${DEBIAN_DIST} as builder WORKDIR /usr/src/typos COPY . . RUN cargo install --path . -FROM debian:bullseye-slim +FROM debian:${DEBIAN_DIST}-slim COPY --from=builder /usr/local/cargo/bin/typos /usr/local/bin/typos CMD ["typos"]