You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2023/03/27 19:57:27 UTC

[tika-docker] branch master updated: Reduce the amount of leftovers in the image (#17)

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika-docker.git


The following commit(s) were added to refs/heads/master by this push:
     new bee9d98  Reduce the amount of leftovers in the image (#17)
bee9d98 is described below

commit bee9d98c5ecda24d7761ab344f9e3151dfb8269a
Author: Trenton H <79...@users.noreply.github.com>
AuthorDate: Mon Mar 27 12:57:19 2023 -0700

    Reduce the amount of leftovers in the image (#17)
    
    W00t! Thank you @stumpylog
---
 full/Dockerfile    | 47 +++++++++++++++++++++++++++--------------------
 minimal/Dockerfile | 29 +++++++++++++++--------------
 2 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/full/Dockerfile b/full/Dockerfile
index 6740170..96d09ee 100644
--- a/full/Dockerfile
+++ b/full/Dockerfile
@@ -16,25 +16,9 @@
 ARG UID_GID="35002:35002"
 
 FROM ubuntu:jammy as base
-RUN apt-get update
-# tesseract 5 is not yet in the base repo
-RUN apt-get -y install software-properties-common
-RUN add-apt-repository -y ppa:alex-p/tesseract-ocr5
 
+FROM base as fetch_tika
 
-FROM base as dependencies
-
-ARG UID_GID
-ARG JRE='openjdk-17-jre-headless'
-
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install $JRE gdal-bin tesseract-ocr \
-        tesseract-ocr-eng tesseract-ocr-ita tesseract-ocr-fra tesseract-ocr-spa tesseract-ocr-deu
-
-RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \
-    && DEBIAN_FRONTEND=noninteractive apt-get install -y xfonts-utils fonts-freefont-ttf fonts-liberation ttf-mscorefonts-installer wget cabextract
-
-FROM dependencies as fetch_tika
-ARG UID_GID
 ARG TIKA_VERSION
 ARG CHECK_SIG=true
 
@@ -45,7 +29,7 @@ ENV NEAREST_TIKA_SERVER_URL="https://dlcdn.apache.org/tika/${TIKA_VERSION}/tika-
     ARCHIVE_TIKA_SERVER_ASC_URL="https://archive.apache.org/dist/tika/${TIKA_VERSION}/tika-server-standard-${TIKA_VERSION}.jar.asc" \
     TIKA_VERSION=$TIKA_VERSION
 
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg2 wget \
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y install gnupg2 wget ca-certificates \
     && wget -t 10 --max-redirect 1 --retry-connrefused -qO- https://downloads.apache.org/tika/KEYS | gpg --import \
     && wget -t 10 --max-redirect 1 --retry-connrefused $NEAREST_TIKA_SERVER_URL -O /tika-server-standard-${TIKA_VERSION}.jar || rm /tika-server-standard-${TIKA_VERSION}.jar \
     && sh -c "[ -f /tika-server-standard-${TIKA_VERSION}.jar ]" || wget $ARCHIVE_TIKA_SERVER_URL -O /tika-server-standard-${TIKA_VERSION}.jar || rm /tika-server-standard-${TIKA_VERSION}.jar \
@@ -57,9 +41,32 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg2 wget \
 
 RUN if [ "$CHECK_SIG" = "true" ] ; then gpg --verify /tika-server-standard-${TIKA_VERSION}.jar.asc /tika-server-standard-${TIKA_VERSION}.jar; fi
 
-FROM dependencies as runtime
+FROM base as runtime
 ARG UID_GID
-RUN apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+ARG JRE='openjdk-17-jre-headless'
+RUN set -eux \
+    && apt-get update \
+    && apt-get install --yes --no-install-recommends gnupg2 software-properties-common \
+    && add-apt-repository -y ppa:alex-p/tesseract-ocr5 \
+    && apt-get update \
+    && DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends $JRE \
+        gdal-bin \
+        tesseract-ocr \
+        tesseract-ocr-eng \
+        tesseract-ocr-ita \
+        tesseract-ocr-fra \
+        tesseract-ocr-spa \
+        tesseract-ocr-deu \
+    && echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \
+    && DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
+        xfonts-utils \
+        fonts-freefont-ttf \
+        fonts-liberation \
+        ttf-mscorefonts-installer \
+        wget \
+        cabextract \
+    && apt-get clean -y \
+    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ARG TIKA_VERSION
 ENV TIKA_VERSION=$TIKA_VERSION
 
diff --git a/minimal/Dockerfile b/minimal/Dockerfile
index 00a5b86..ce413e0 100644
--- a/minimal/Dockerfile
+++ b/minimal/Dockerfile
@@ -17,19 +17,9 @@
 ARG UID_GID="35002:35002"
 
 FROM ubuntu:jammy as base
-RUN apt-get update
 
-FROM base as dependencies
+FROM base as fetch_tika
 
-# must reference uid_gid
-ARG UID_GID
-ARG JRE='openjdk-17-jre-headless'
-
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install $JRE
-
-FROM dependencies as fetch_tika
-# must reference uid_gid
-ARG UID_GID
 ARG TIKA_VERSION
 ARG CHECK_SIG=true
 
@@ -40,7 +30,12 @@ ENV NEAREST_TIKA_SERVER_URL="https://dlcdn.apache.org/tika/${TIKA_VERSION}/tika-
     ARCHIVE_TIKA_SERVER_ASC_URL="https://archive.apache.org/dist/tika/${TIKA_VERSION}/tika-server-standard-${TIKA_VERSION}.jar.asc" \
     TIKA_VERSION=$TIKA_VERSION
 
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg2 wget \
+RUN set -eux \
+    && apt-get update \
+    && DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
+        gnupg2 \
+        wget \
+        ca-certificates \
     && wget -t 10 --max-redirect 1 --retry-connrefused -qO- https://downloads.apache.org/tika/KEYS | gpg --import \
     && wget -t 10 --max-redirect 1 --retry-connrefused $NEAREST_TIKA_SERVER_URL -O /tika-server-standard-${TIKA_VERSION}.jar || rm /tika-server-standard-${TIKA_VERSION}.jar \
     && sh -c "[ -f /tika-server-standard-${TIKA_VERSION}.jar ]" || wget $ARCHIVE_TIKA_SERVER_URL -O /tika-server-standard-${TIKA_VERSION}.jar || rm /tika-server-standard-${TIKA_VERSION}.jar \
@@ -52,10 +47,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg2 wget \
 
 RUN if [ "$CHECK_SIG" = "true" ] ; then gpg --verify /tika-server-standard-${TIKA_VERSION}.jar.asc /tika-server-standard-${TIKA_VERSION}.jar; fi
 
-FROM dependencies as runtime
+FROM base as runtime
 # must reference uid_gid
 ARG UID_GID
-RUN apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+ARG JRE='openjdk-17-jre-headless'
+RUN set -eux \
+    && apt-get update \
+    && apt-get install --yes --no-install-recommends \
+        ${JRE} \
+        ca-certificates \
+    && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ARG TIKA_VERSION
 ENV TIKA_VERSION=$TIKA_VERSION
 COPY --from=fetch_tika /tika-server-standard-${TIKA_VERSION}.jar /tika-server-standard-${TIKA_VERSION}.jar