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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HQDMfwuPuj8sqHDQTcLty8
This commit is contained in:
Sam Dornan
2026-09-26 15:47:05 +00:00
committed by Claude
parent 3716d71ca8
commit 39e49889cc
2 changed files with 16 additions and 8 deletions

View File

@@ -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;

View File

@@ -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 && \