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 20:30:54 UTC

[tika-docker] 01/01: Revert "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 revert-17-feature-reduce-image-leftovers
in repository https://gitbox.apache.org/repos/asf/tika-docker.git

commit 9e56ef521028e60ed78b544049b5e3c2083691ff
Author: Tim Allison <ta...@gmail.com>
AuthorDate: Mon Mar 27 16:30:49 2023 -0400

    Revert "Reduce the amount of leftovers in the image (#17)"
    
    This reverts commit bee9d98c5ecda24d7761ab344f9e3151dfb8269a.
---
 full/Dockerfile    | 47 ++++++++++++++++++++---------------------------
 minimal/Dockerfile | 29 ++++++++++++++---------------
 2 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/full/Dockerfile b/full/Dockerfile
index 96d09ee..6740170 100644
--- a/full/Dockerfile
+++ b/full/Dockerfile
@@ -16,9 +16,25 @@
 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
 
@@ -29,7 +45,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 update && apt-get -y install gnupg2 wget ca-certificates \
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg2 wget \
     && 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 \
@@ -41,32 +57,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y install gnupg2 w
 
 RUN if [ "$CHECK_SIG" = "true" ] ; then gpg --verify /tika-server-standard-${TIKA_VERSION}.jar.asc /tika-server-standard-${TIKA_VERSION}.jar; fi
 
-FROM base as runtime
+FROM dependencies as runtime
 ARG UID_GID
-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/*
+RUN 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 ce413e0..00a5b86 100644
--- a/minimal/Dockerfile
+++ b/minimal/Dockerfile
@@ -17,9 +17,19 @@
 ARG UID_GID="35002:35002"
 
 FROM ubuntu:jammy as base
+RUN apt-get update
 
-FROM base as fetch_tika
+FROM base as dependencies
 
+# 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
 
@@ -30,12 +40,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 set -eux \
-    && apt-get update \
-    && DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
-        gnupg2 \
-        wget \
-        ca-certificates \
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gnupg2 wget \
     && 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 \
@@ -47,16 +52,10 @@ RUN set -eux \
 
 RUN if [ "$CHECK_SIG" = "true" ] ; then gpg --verify /tika-server-standard-${TIKA_VERSION}.jar.asc /tika-server-standard-${TIKA_VERSION}.jar; fi
 
-FROM base as runtime
+FROM dependencies as runtime
 # must reference uid_gid
 ARG UID_GID
-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/*
+RUN 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