From 45ba07cd0706f649c5a7f9794ceaf6cdc486d94a Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Tue, 30 Dec 2025 13:45:01 +0100 Subject: [PATCH] Reduce final image size These optimizations reduce the final image size by over 60%. --- Dockerfile | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index e848f4e..92b8b0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,31 @@ -FROM debian:latest +FROM debian:bullseye-slim -# Used in the makefile -ENV CHORDPRO_PIPELINE true +ENV CHORDPRO_PIPELINE=true ARG ZOLA_VERSION="0.21.0" ARG CHORDPRO_VERSION="6.090.0" -RUN apt update -y && apt-get install -y --no-install-recommends \ - ca-certificates openssl openssh-client rsync git wget build-essential cpanminus libio-socket-ssl-perl ghostscript nodejs -RUN update-ca-certificates -RUN cpanm chordpro@${CHORDPRO_VERSION} -RUN wget https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz && \ - tar -xvzf zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz && \ - mv zola /usr/local/bin/zola && \ - rm zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz +# Install runtime dependencies only, clean up after +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + openssl \ + openssh-client \ + rsync \ + git \ + wget \ + libio-socket-ssl-perl \ + ghostscript \ + nodejs \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y --no-install-recommends build-essential cpanminus \ + && cpanm chordpro@${CHORDPRO_VERSION} \ + && apt-get purge -y --auto-remove build-essential cpanminus \ + && rm -rf /root/.cpanm /var/lib/apt/lists/* + +RUN wget -q https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz \ + && tar -xzf zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz \ + && mv zola /usr/local/bin/ \ + && rm zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz CMD ["/bin/sh"]