From 39e49889cc7d701d015162e44ca4b7d6af3789f4 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sat, 26 Sep 2026 15:47:05 +0000 Subject: [PATCH] chore(docker): fetch libchdr with ADD --checksum Download the pinned commit's source tarball, verified by sha256, rather than cloning the repository, matching how #4781 fetches the other third-party downloads. The production libchdr-build stage no longer needs git. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HQDMfwuPuj8sqHDQTcLty8 --- Dockerfile | 12 ++++++++---- docker/Dockerfile | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 304915bea..cf96c5828 100644 --- a/Dockerfile +++ b/Dockerfile @@ -158,15 +158,19 @@ RUN git clone --filter=blob:none https://github.com/rommapp/argosy-sigil.git /tm && rm -rf /tmp/argosy-sigil # Build and install libchdr (optional, for CD audio in CHD images). -# Keep the pin in sync with docker/Dockerfile. +# Keep the pins in sync with docker/Dockerfile. ARG LIBCHDR_COMMIT=8e7b8bd32bc676b7e5c6b42fe7d2daca986c4a0d -RUN git clone --filter=blob:none https://github.com/rtissera/libchdr.git /tmp/libchdr \ - && git -C /tmp/libchdr checkout "${LIBCHDR_COMMIT}" \ +ARG LIBCHDR_SHA256=04d6c61946c95addb78f4554740283b93249b81d8437e3d8a58ca1899c824dcc +ADD --checksum=sha256:${LIBCHDR_SHA256} \ + "https://github.com/rtissera/libchdr/archive/${LIBCHDR_COMMIT}.tar.gz" \ + /tmp/libchdr.tar.gz +RUN mkdir /tmp/libchdr \ + && tar -xzf /tmp/libchdr.tar.gz -C /tmp/libchdr --strip-components=1 \ && cmake -S /tmp/libchdr -B /tmp/libchdr/build -DCMAKE_BUILD_TYPE=Release -DCHDR_WANT_TESTS=OFF \ && cmake --build /tmp/libchdr/build --target chdr \ && cp -P /tmp/libchdr/build/libchdr.so* /usr/local/lib/ \ && ldconfig \ - && rm -rf /tmp/libchdr + && rm -rf /tmp/libchdr /tmp/libchdr.tar.gz WORKDIR /app # Kept outside /app/frontend because the ./frontend bind mount hides it; diff --git a/docker/Dockerfile b/docker/Dockerfile index 93682accc..bd141c4a1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -146,20 +146,24 @@ RUN git clone --filter=blob:none https://github.com/rommapp/argosy-sigil.git && # LIBCHDR (BSD-3-Clause) FOR CD AUDIO IN CHD IMAGES -# Keep this pin in sync with the dev image's LIBCHDR_COMMIT in ../Dockerfile. +# Keep these pins in sync with the dev image's copies in ../Dockerfile. +# checkov:skip=CKV_DOCKER_4:the ADD below is a remote URL pinned by --checksum FROM alpine:${ALPINE_VERSION}@sha256:${ALPINE_SHA256} AS libchdr-build # trunk-ignore(hadolint/DL3018) RUN apk add --no-cache \ cmake \ g++ \ - git \ make \ musl-dev ARG LIBCHDR_COMMIT=8e7b8bd32bc676b7e5c6b42fe7d2daca986c4a0d +ARG LIBCHDR_SHA256=04d6c61946c95addb78f4554740283b93249b81d8437e3d8a58ca1899c824dcc -RUN git clone --filter=blob:none https://github.com/rtissera/libchdr.git ./libchdr-src && \ - git -C ./libchdr-src checkout "${LIBCHDR_COMMIT}" && \ +ADD --checksum=sha256:${LIBCHDR_SHA256} \ + "https://github.com/rtissera/libchdr/archive/${LIBCHDR_COMMIT}.tar.gz" \ + /downloads/libchdr.tar.gz +RUN mkdir ./libchdr-src && \ + tar -xzf /downloads/libchdr.tar.gz -C ./libchdr-src --strip-components=1 && \ cmake -S ./libchdr-src -B ./libchdr-src/build -DCMAKE_BUILD_TYPE=Release -DCHDR_WANT_TESTS=OFF && \ cmake --build ./libchdr-src/build --target chdr && \ mkdir /libchdr && \