From e761b73cfd4e417d86e8026810c7d9f11efd325a Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 30 Mar 2021 17:57:37 +0100 Subject: [PATCH 1/4] Avoid additional packages by specifying --no-install-recommends. https://github.com/hadolint/hadolint/wiki/DL3015 --- build/base/Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build/base/Dockerfile b/build/base/Dockerfile index facabd3a..e501cd9b 100644 --- a/build/base/Dockerfile +++ b/build/base/Dockerfile @@ -9,7 +9,7 @@ FROM debian:buster-slim RUN echo "deb http://httpredir.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list &&\ apt-get update &&\ - apt-get install -y curl wget gnupg ttf-mscorefonts-installer procps + apt-get install --no-install-recommends -y curl wget gnupg ttf-mscorefonts-installer procps # |-------------------------------------------------------------------------- # | Chrome @@ -21,7 +21,7 @@ RUN echo "deb http://httpredir.debian.org/debian/ buster main contrib non-free" RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - &&\ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list &&\ apt-get update &&\ - apt-get -y --allow-unauthenticated install google-chrome-stable + apt-get install --no-install-recommends -y --allow-unauthenticated google-chrome-stable # |-------------------------------------------------------------------------- # | LibreOffice @@ -34,7 +34,7 @@ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add RUN mkdir -p /usr/share/man/man1mkdir -p /usr/share/man/man1 &&\ echo "deb http://httpredir.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list &&\ apt-get update &&\ - apt-get -t buster-backports -y install libreoffice + apt-get --no-install-recommends -t buster-backports -y install libreoffice # |-------------------------------------------------------------------------- # | Unoconv @@ -74,7 +74,8 @@ RUN wget -O /usr/bin/pdftk "https://gitlab.com/pdftk-java/pdftk/-/jobs/${PDFTK_V # Credits: # https://github.com/arachnys/athenapdf/blob/master/cli/Dockerfile # https://help.accusoft.com/PrizmDoc/v12.1/HTML/Installing_Asian_Fonts_on_Ubuntu_and_Debian.html -RUN apt-get install -y \ +RUN apt-get update &&\ + apt-get install --no-install-recommends -y \ culmus \ fonts-beng \ fonts-hosny-amiri \ From d42e51315d2bbfb4dfb4ba5524e8b7007d438997 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 30 Mar 2021 17:58:38 +0100 Subject: [PATCH 2/4] Delete the apt-get lists after installing something. https://github.com/hadolint/hadolint/wiki/DL3009 --- build/base/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build/base/Dockerfile b/build/base/Dockerfile index e501cd9b..53a92756 100644 --- a/build/base/Dockerfile +++ b/build/base/Dockerfile @@ -9,7 +9,8 @@ FROM debian:buster-slim RUN echo "deb http://httpredir.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list &&\ apt-get update &&\ - apt-get install --no-install-recommends -y curl wget gnupg ttf-mscorefonts-installer procps + apt-get install --no-install-recommends -y curl wget gnupg ttf-mscorefonts-installer procps &&\ + rm -rf /var/lib/apt/lists/* # |-------------------------------------------------------------------------- # | Chrome @@ -21,7 +22,8 @@ RUN echo "deb http://httpredir.debian.org/debian/ buster main contrib non-free" RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - &&\ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list &&\ apt-get update &&\ - apt-get install --no-install-recommends -y --allow-unauthenticated google-chrome-stable + apt-get install --no-install-recommends -y --allow-unauthenticated google-chrome-stable &&\ + rm -rf /var/lib/apt/lists/* # |-------------------------------------------------------------------------- # | LibreOffice @@ -34,7 +36,8 @@ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add RUN mkdir -p /usr/share/man/man1mkdir -p /usr/share/man/man1 &&\ echo "deb http://httpredir.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list &&\ apt-get update &&\ - apt-get --no-install-recommends -t buster-backports -y install libreoffice + apt-get --no-install-recommends -t buster-backports -y install libreoffice &&\ + rm -rf /var/lib/apt/lists/* # |-------------------------------------------------------------------------- # | Unoconv @@ -95,7 +98,8 @@ RUN apt-get update &&\ fonts-arphic-uming \ fonts-ipafont-mincho \ fonts-ipafont-gothic \ - fonts-unfonts-core + fonts-unfonts-core &&\ + rm -rf /var/lib/apt/lists/* COPY build/base/fonts/* /usr/local/share/fonts/ COPY build/base/fonts.conf /etc/fonts/conf.d/100-gotenberg.conf From f841aef82d916e965399a3779bda8c048a39089e Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 30 Mar 2021 20:29:55 +0100 Subject: [PATCH 3/4] install ttf-mscorefonts-installer 3.8 --- build/base/Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/base/Dockerfile b/build/base/Dockerfile index 53a92756..bb977b09 100644 --- a/build/base/Dockerfile +++ b/build/base/Dockerfile @@ -6,10 +6,16 @@ FROM debian:buster-slim # | # | Libraries used in the build process of this image. # | +RUN apt-get update &&\ + apt-get --no-install-recommends install -y ca-certificates wget curl gnupg procps &&\ + rm -rf /var/lib/apt/lists/* -RUN echo "deb http://httpredir.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list &&\ - apt-get update &&\ - apt-get install --no-install-recommends -y curl wget gnupg ttf-mscorefonts-installer procps &&\ +# |-------------------------------------------------------------------------- +# | Microsoft font installer +# |-------------------------------------------------------------------------- +RUN apt-get update &&\ + curl -o ./ttf-mscorefonts-installer_3.8_all.deb http://httpredir.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.8_all.deb &&\ + apt --no-install-recommends install -y ./ttf-mscorefonts-installer_3.8_all.deb && rm ./ttf-mscorefonts-installer_3.8_all.deb &&\ rm -rf /var/lib/apt/lists/* # |-------------------------------------------------------------------------- From 0c8ad9262ef4e9a9537e3b370fbfd5f557139a55 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 30 Mar 2021 20:30:43 +0100 Subject: [PATCH 4/4] use only curl --- build/base/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build/base/Dockerfile b/build/base/Dockerfile index bb977b09..d307492b 100644 --- a/build/base/Dockerfile +++ b/build/base/Dockerfile @@ -7,7 +7,7 @@ FROM debian:buster-slim # | Libraries used in the build process of this image. # | RUN apt-get update &&\ - apt-get --no-install-recommends install -y ca-certificates wget curl gnupg procps &&\ + apt-get --no-install-recommends install -y ca-certificates curl gnupg procps &&\ rm -rf /var/lib/apt/lists/* # |-------------------------------------------------------------------------- @@ -24,8 +24,7 @@ RUN apt-get update &&\ # | # | Installs Chrome. # | - -RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - &&\ +RUN curl https://dl.google.com/linux/linux_signing_key.pub | apt-key add - &&\ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list &&\ apt-get update &&\ apt-get install --no-install-recommends -y --allow-unauthenticated google-chrome-stable &&\ @@ -69,7 +68,7 @@ RUN curl -Ls $UNO_URL -o /usr/bin/unoconv &&\ ARG PDFTK_VERSION=924565150 -RUN wget -O /usr/bin/pdftk "https://gitlab.com/pdftk-java/pdftk/-/jobs/${PDFTK_VERSION}/artifacts/raw/build/native-image/pdftk" \ +RUN curl -o /usr/bin/pdftk "https://gitlab.com/pdftk-java/pdftk/-/jobs/${PDFTK_VERSION}/artifacts/raw/build/native-image/pdftk" \ && chmod a+x /usr/bin/pdftk # |--------------------------------------------------------------------------