Files
shadow/docker/Dockerfile.alpine
T
Pierre Warnier 04427511e1 docker: install cargo-deny as a pinned prebuilt binary (#175)
The dev images built cargo-deny from source via `cargo install cargo-deny`.
That compiled cargo-deny on every image build (multi-minute) and surfaced
cargo-deny's own `profile.dev.package.{insta,similar}` warnings, which look
like our config but are not.

Install the pinned (0.19.8), checksum-verified prebuilt binary instead. The
static musl build runs on glibc too, so all three images share one asset.
Result: no source compile, no spurious warnings, and a reproducible,
sha256-verified install (vs the previous unpinned `cargo install`). Each
build self-checks with `cargo-deny --version`.

Version/checksum are ARGs so they can be bumped (and tracked by Renovate).
2026-06-10 15:06:33 +02:00

43 lines
1.7 KiB
Docker

# shadow-rs development image — Alpine 3.23 (musl libc)
#
# PAM: linux-pam-dev (Linux-PAM, not OpenPAM)
# SELinux: not available (Alpine doesn't ship SELinux)
# Default shell: /bin/ash (busybox)
# Shadow-utils package: shadow
# Note: musl libc — different from glibc. Tests NSS/getpwent differences.
# No SELinux. Busybox shadow-utils may differ from GNU shadow-utils.
FROM rust:alpine
RUN apk add --no-cache \
musl-dev \
linux-pam-dev \
linux-headers \
pkgconf \
shadow \
bash \
curl
RUN rustup component add clippy rustfmt \
&& curl -LsSf https://get.nexte.st/latest/linux-musl | tar zxf - -C /usr/local/cargo/bin
# cargo-deny: pinned, checksum-verified prebuilt binary. The static musl build
# runs on glibc too, so every image shares one asset. Installing the binary
# (instead of `cargo install cargo-deny`) skips a multi-minute source compile.
ARG CARGO_DENY_VERSION=0.19.8
ARG CARGO_DENY_SHA256=70e769ae3872e34d45132b17040859175e11401dc12dddb0303e0b8c7d088f3f
RUN curl -LsSf "https://github.com/EmbarkStudios/cargo-deny/releases/download/${CARGO_DENY_VERSION}/cargo-deny-${CARGO_DENY_VERSION}-x86_64-unknown-linux-musl.tar.gz" -o /tmp/cargo-deny.tar.gz \
&& echo "${CARGO_DENY_SHA256} /tmp/cargo-deny.tar.gz" | sha256sum -c - \
&& tar zxf /tmp/cargo-deny.tar.gz -C /tmp \
&& install -m 0755 "/tmp/cargo-deny-${CARGO_DENY_VERSION}-x86_64-unknown-linux-musl/cargo-deny" /usr/local/cargo/bin/cargo-deny \
&& rm -rf /tmp/cargo-deny.tar.gz "/tmp/cargo-deny-${CARGO_DENY_VERSION}-x86_64-unknown-linux-musl" \
&& cargo-deny --version
RUN adduser -D -s /bin/bash testuser \
&& adduser -D -s /bin/sh testuser2 \
&& addgroup testgroup \
&& addgroup testuser testgroup
WORKDIR /workspace
CMD ["/bin/bash"]