FROM debian:bookworm-slim
# Basic non-interactive frontend for apt
ENV DEBIAN_FRONTEND=noninteractive
# Install required build tools and utilities
RUN set -eux; \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
unzip \
patch \
ca-certificates \
git \
tidy; \
rm -rf /var/lib/apt/lists/*
# Provide a no-op codesign to bypass macOS-only signing steps on Linux
RUN ln -sf /bin/true /usr/local/bin/codesign || true
# Provide a no-op hiutil to bypass macOS-only helpers in Linux builds
RUN printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/hiutil && chmod +x /usr/local/bin/hiutil
# Work from the repository root
WORKDIR /src
# Copy repository contents into the image
COPY . /src
# Initialize any git submodules (the build uses fetch-submodule script)
RUN git submodule update --init --recursive || true
# Expose built binaries in PATH for easier testing (defaults to /usr/local/bin which we populate later)
ENV PATH="/usr/local/bin:$PATH"
# Build all components (order follows the blueprint)
RUN make -C imageoptim build && \
make -C gifsicle build && \
make -C guetzli build && \
make -C pngquant build && \
make -C zopfli-png build
# Expose any built executables by symlinking them into /usr/local/bin
RUN set -eux; \
for f in $(find /src -type f -path '*/bin/*' -executable); do \
ln -sf "$f" "/usr/local/bin/$(basename "$f")"; \
done || true
# Default to an interactive shell for inspection, can be overridden
CMD ["bash"]