Skip to content

Instantly share code, notes, and snippets.

@dkam
Last active February 22, 2024 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkam/eb57697b73c7c4b210bc7ab8fe43b97a to your computer and use it in GitHub Desktop.
Save dkam/eb57697b73c7c4b210bc7ab8fe43b97a to your computer and use it in GitHub Desktop.
Docker build stage for JXL
#...
WORKDIR /rails
#...
# https://github.com/libjxl/libjxl/blob/main/BUILDING.md
FROM base as buildjxl
ENV CC=clang
ENV CXX=clang++
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y git cmake pkg-config libbrotli-dev libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev clang make build-essential && \
git clone https://github.com/libjxl/libjxl.git --recursive --shallow-submodules && \
cd libjxl && git submodule update --init --recursive --depth 1 --recommend-shallow
RUN cd libjxl && mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. && \
cmake --build . -- -j$(nproc) && ls -l tools
# Sometime later in the final stage....
COPY --from=buildjxl /rails/libjxl/build/tools/cjxl bin/
COPY --from=buildjxl /rails/libjxl/build/tools/djxl bin/
COPY --from=buildjxl /rails/libjxl/build/lib /rails/
# The final layer will need `libgif7` installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment