From e806cfad7591616c7ffb6a9b8f4ef5d1d0dc1118 Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Fri, 15 Apr 2022 17:06:56 -0400 Subject: [PATCH 1/9] PHP8 multiarch and improvements on NPL --- esmero-php-fpm/Dockerfile | 157 ++++++++++++++++++++++++++++++---- esmero-php-fpm/Dockerfile.dev | 4 +- esmero-php-fpm/README.md | 27 ++++-- nlpserver/Dockerfile | 38 ++++++-- 4 files changed, 190 insertions(+), 36 deletions(-) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index d8c563f..153e64a 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -1,22 +1,46 @@ -# from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements -FROM php:7.4-fpm-alpine +# from https://www.drupal.org/docs/9/system-requirements/drupal-9-php-requirements +FROM php:8.0.16-fpm-alpine3.15 # install the PHP extensions we need # postgresql-dev is needed for https://bugs.alpinelinux.org/issues/3642 + +# FONTS? + +RUN apk --no-cache add msttcorefonts-installer fontconfig && \ + update-ms-fonts && \ + fc-cache -f + +# For now not going pdftotree +#RUN set -eux; \ +# \ +# apk add --update python3-dev \ +# py3-pip \ +# linux-headers \ +# musl-dev \ +# build-base \ +# hdf5 \ +# hdf5-dev \ +# py3-pip py3-numpy py3-pandas py3-scipy py3-scikit-learn py3-wheel py3-pillow jpeg-dev zlib-dev +#RUN set -eux; pip install --no-cache-dir --no-binary :all: tables h5py +#RUN set -eux; pip install pdftotree + RUN set -eux; \ \ apk add --no-cache --virtual .build-deps \ coreutils \ - zlib-dev \ + zlib-dev \ libxml2-dev \ libxslt-dev \ freetype-dev \ libjpeg-turbo-dev \ libpng-dev \ + # zlib \ libzip-dev \ postgresql-dev \ - php7-dev \ + php8-dev \ # Equivalent of build essentials alpine-sdk \ + pcre-dev \ + $PHPIZE_DEPS \ imagemagick \ imagemagick-libs \ imagemagick-dev \ @@ -49,11 +73,13 @@ RUN set -eux; \ )"; \ pecl install imagick; \ pecl install apcu; \ + pecl install redis; \ \ apk add --virtual .drupal-phpexts-rundeps $runDeps; \ docker-php-ext-enable imagick; \ docker-php-ext-enable apcu; \ docker-php-ext-enable pcntl; \ + docker-php-ext-enable redis.so; \ apk del .build-deps # set recommended PHP.ini settings @@ -74,7 +100,7 @@ RUN { \ echo 'max_execution_time = 300'; \ echo 'log_errors = On'; \ echo 'error_log = /proc/self/fd/2'; \ - } > /usr/local/etc/php/conf.d/archipelagod8-recommended.ini + } > /usr/local/etc/php/conf.d/archipelagod9-recommended.ini RUN { \ echo 'php_admin_value[error_log] = /proc/self/fd/2'; \ @@ -92,7 +118,7 @@ RUN { \ echo 'error_log = /proc/self/fd/2'; \ } > /usr/local/etc/php/php-cli.ini - + # Tools we want to keep RUN apk -U add --no-cache \ bash \ @@ -104,39 +130,133 @@ RUN apk -U add --no-cache \ file \ curl \ nano \ + libxml2 \ ghostscript \ poppler-utils \ python3 \ - tesseract-ocr \ + xpdf \ + freetype \ + icu-libs \ tesseract-ocr-data-ita \ tesseract-ocr-data-spa \ - tesseract-ocr-data-deu \ - tesseract-ocr-data-tam \ - tesseract-ocr-data-por \ - mediainfo \ + tesseract-ocr-data-deu \ + tesseract-ocr-data-tam \ + tesseract-ocr-data-por \ + tesseract-ocr-data-hin \ + mediainfo \ exiftool \ py3-setuptools \ + py-pip \ && \ rm -rf /var/lib/apt/lists/* && \ rm /var/cache/apk/* +WORKDIR /usr/local/src + +# Detect architecture for Tesseract 5 +RUN set -eux; \ +ARCH="$(uname -m)"; \ +case "${ARCH}" in \ + aarch64|arm64) \ + musl='aarch64-alpine-linux-musl'; \ + ;; \ + amd64|x86_64) \ + musl='x86_64-alpine-linux-musl'; \ + ;; \ + *) \ + echo "Unsupported arch: ${ARCH}"; \ + exit 1; \ + ;; \ +esac; + +# Build Tesseract 5 +RUN apk update && apk add --no-cache --virtual .build-deps-tesseract \ + gcc \ + g++ \ + make \ + automake \ + autoconf \ + musl \ + libc-dev \ + libtool \ + alpine-sdk \ + pkgconfig \ + clang \ + clang-dev \ + libtool \ + leptonica-dev \ + openjpeg-dev \ + tiff-dev \ + libpng-dev \ + zlib-dev \ + libgcc \ + mupdf-dev \ + jbig2dec-dev \ + freetype-dev \ + openblas-dev \ + ffmpeg-dev \ + icu-dev \ + git \ + linux-headers && \ + git clone --depth 1 https://github.com/danbloomberg/leptonica.git && cd leptonica && ./autogen.sh && ./configure --build=${musl} --host=${musl} && make && make install && cd ..;\ + git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git && cd tesseract && ./autogen.sh; \ + ./configure --build=${musl} --host=${musl} ;\ + make && make install && ldconfig ;\ + apk del .build-deps-tesseract; + +RUN pwd; uname -a; + +# Build PDF Alto +WORKDIR /usr/src +RUN git clone --depth 1 https://github.com/diegopino/pdfalto.git -b alpine +RUN git clone https://github.com/diegopino/xpdf-4.03.git -b alpine && cp -rpv xpdf-4.03 /usr/src/pdfalto/. + +WORKDIR /usr/src/pdfalto +RUN set -eux; \ +\ +apk update && apk add --no-cache --virtual .build-deps-pdfalto \ + git \ + cmake \ + make \ + musl \ + musl-dev \ + g++ gcc clang clang-dev clang-extra-tools clang-libs \ + libpng-dev \ + icu-libs \ + icu-dev \ + libgcc \ + tiff-dev \ + freetype-dev \ + libc-dev \ + linux-headers \ + libxml2-dev \ + glib \ + pkgconfig \ + glib-dev && \ + cd /usr/src/pdfalto/libs/image/png/src && cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" . && make && \ + cp /usr/src/pdfalto/libs/image/png/src/libpng.a /usr/src/pdfalto/libs/image/png/linux/64/ && \ + cd /usr/src/pdfalto && cmake . && make && make install && cp pdfalto /usr/bin/pdfalto; \ + apk del .build-deps-pdfalto; + + RUN apk add gnu-libiconv --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php +WORKDIR /usr/src/ # Installation of Composer RUN cd /usr/src && curl -sS http://getcomposer.org/installer | php RUN cd /usr/src && mv composer.phar /usr/bin/composer && composer self-update && composer self-update --2 # Installation of drush RUN git clone https://github.com/drush-ops/drush.git /usr/local/src/drush -RUN cd /usr/local/src/drush && git checkout 10.3.6 +RUN cd /usr/local/src/drush && git checkout 11.0.5 RUN ln -s /usr/local/src/drush/drush /usr/bin/drush RUN cd /usr/local/src/drush && composer update && composer install # Install Fido -RUN cd /usr/src && wget https://github.com/openpreserve/fido/archive/v1.4.0.zip && unzip v1.4.0.zip \ - && ln -s /usr/bin/python3 /usr/bin/python -RUN cd /usr/src/fido-1.4.0 && ./setup.py install +RUN cd /usr/src && wget https://github.com/openpreserve/fido/archive/v1.4.1.zip && unzip v1.4.1.zip \ + && ln -s /usr/bin/python3 /usr/bin/python && pip install wheel +RUN cd /usr/src/fido-1.4.1 && ./setup.py install # Install WACZ RUN set -eux; \ @@ -147,12 +267,15 @@ RUN set -eux; \ linux-headers \ musl-dev \ && \ - git clone https://github.com/webrecorder/wacz-format.git /usr/local/src/wacz && \ + git clone https://github.com/webrecorder/py-wacz /usr/local/src/wacz && \ cd /usr/local/src/wacz/ && git checkout main && \ - cd /usr/local/src/wacz/py-wacz && pip3 install -r requirements.txt && chmod 755 setup.py && ./setup.py install + pip3 install -r requirements.txt && chmod 755 setup.py && ./setup.py install #Clean up sources, we need to keep drush one RUN rm -rf /usr/local/src/wacz +RUN rm -rf /usr/local/src/tesseract +RUN rm -rf /usr/src/pdfalto +RUN rm -rf /usr/src/xpdf # Change to bash since our folks like bash SHELL ["/bin/bash", "-c"] diff --git a/esmero-php-fpm/Dockerfile.dev b/esmero-php-fpm/Dockerfile.dev index 1b4e00b..cee4083 100644 --- a/esmero-php-fpm/Dockerfile.dev +++ b/esmero-php-fpm/Dockerfile.dev @@ -1,8 +1,8 @@ # build with: -# sudo docker build -f Dockerfile.dev -t esmero/php-7.4-fpm:1.0.0-dev-multiarch . --no-cache +# sudo docker build -f Dockerfile.dev -t esmero/php-8.0-fpm:1.0.0-dev-multiarch . --no-cache # from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements -FROM esmero/php-7.4-fpm:1.0.0-RC2-multiarch +FROM esmero/php-8.0-fpm:1.0.0-multiarch # install the extensions we need for xdebug install RUN set -eux; \ diff --git a/esmero-php-fpm/README.md b/esmero-php-fpm/README.md index a663531..b9465ff 100644 --- a/esmero-php-fpm/README.md +++ b/esmero-php-fpm/README.md @@ -1,10 +1,10 @@ -## Esmero-php FPM 7.4.9 Container +## Esmero-php FPM 8.0.16 Container -A ready to be used with Archipelago in a docker-compose file with NGINX . Runs a standard PHP 7.4.9 FPM Container with some embeded extras. +A ready to be used with Archipelago in a docker-compose file with NGINX. Runs a standard PHP 8.0.16 FPM Container with embeded extras. ### Building the image ```SHELL -$ docker build -t esmero/php-7.4-fpm:1.0.0-RC1 . +$ docker build -t esmero/php-8.0-fpm:1.0.0 . ```` ### Configuration and startup @@ -13,8 +13,19 @@ Use with an NGINX Container using fastcgi proxying against this container ### Deployed features -PHP 7.4 with OPCACHE and D8/D9 Optimizations -TESSERACT -COMPOSER -DRUSH -BASH (yes) +- PHP 8.0.16 with redis extension and D9 Optimizations +- TESSERACT 5.1 with JP2 support and OpenMP (/usr/local/bin/tesseract) +- TESSERACT 4.x with JP2 support and SSE (/usr/bin/tesseract) +- COMPOSER +- DRUSH +- BASH (yes) +- PDFALTO 0.5 +- FIDO 1.4 +- Webfonts + +#### Multiplaform Build + +docker buildx create --name m1_builder +docker buildx use m1_builder +docker buildx inspect --bootstrap +docker buildx build --platform linux/amd64,linux/arm64 -t esmero/php-8.0-fpm:1.0.0-multiarch . --push diff --git a/nlpserver/Dockerfile b/nlpserver/Dockerfile index abd7d19..5633b95 100644 --- a/nlpserver/Dockerfile +++ b/nlpserver/Dockerfile @@ -1,7 +1,11 @@ # From https://hub.docker.com/_/python # using slim buster because docs say alpine makes python building slower -FROM python:3.8.6-slim-buster +FROM python:3.10.1-slim-buster + +# Use the Architecture to decide on pycld +ARG TARGETPLATFORM + RUN apt-get update && \ apt-get upgrade -y && \ @@ -14,20 +18,36 @@ RUN rm "v1.0.1.tar.gz" && mv nlpserver-1.0.1 nlpserver WORKDIR /usr/src/nlpserver RUN apt-get -y install pkg-config && \ - apt-get install build-essential software-properties-common -y -RUN apt-get -y install -y python-dev python-numpy python3-dev libevent-dev libicu-dev && \ - apt-get -y install -y python3-pip && \ - python3 -m pip install --no-cache-dir --default-timeout=100 -r requirements.txt + apt-get install build-essential git software-properties-common -y && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get -y install -y python-dev python-numpy python3-dev libevent-dev libicu-dev && \ + apt-get -y install -y python3-pip && rm -rf /var/lib/apt/lists/* +# We can't use requirements.txt because of custom ARM64 pycld2 +RUN python3 -m pip install --no-cache-dir --default-timeout=100 newspaper3k +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then BRANCH=master; elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then BRANCH=aarch64; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then BRANCH=aarch64; else BRANCH=master; fi \ + && python3 -m pip install --no-cache-dir --default-timeout=100 -e git+git://github.com/DiegoPino/pycld2.git@${BRANCH}#egg=pycld2 +# RUN python3 -m pip install --no-cache-dir --default-timeout=100 -e git+git://github.com/DiegoPino/pycld2.git@aarch64#egg=pycld2 +RUN python3 -m pip install --no-cache-dir --default-timeout=100 gensim +RUN python3 -m pip install --no-cache-dir --default-timeout=100 pyicu numpy Flask morfessor langid BeautifulSoup4 afinn textblob +RUN python3 -m pip install --no-cache-dir --default-timeout=100 spacy +RUN python3 -m pip install --no-cache-dir --default-timeout=100 polyglot +RUN python3 -m pip install --no-cache-dir --default-timeout=100 readability-lxml + # English, spanish and Italian # TODO add this as built time arguments -RUN polyglot download LANG:en -RUN polyglot download LANG:es -RUN polyglot download LANG:it +RUN polyglot download LANG:en && \ + polyglot download LANG:es && \ + polyglot download LANG:it && \ + polyglot download LANG:pt && \ + polyglot download LANG:de && \ + polyglot download LANG:hi + RUN python3 -m spacy download en && \ python3 -m spacy download xx && \ python3 -m spacy download es && \ - python3 -m spacy download it + python3 -m spacy download pt && \ + python3 -m spacy download de && \ + python3 -m spacy download it # Supervisor COPY nlpserver.conf /etc/supervisor/conf.d From d08f4384f4ae3b43322f0bc33064df0a348a6936 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Wed, 20 Apr 2022 23:37:49 +0100 Subject: [PATCH 2/9] Update Dockerfile to retrieve pycld2 via https:// as GitHub have deprecated git:// --- nlpserver/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nlpserver/Dockerfile b/nlpserver/Dockerfile index 5633b95..8ece0ff 100644 --- a/nlpserver/Dockerfile +++ b/nlpserver/Dockerfile @@ -24,7 +24,7 @@ RUN apt-get update && apt-get -y install -y python-dev python-numpy python3-dev # We can't use requirements.txt because of custom ARM64 pycld2 RUN python3 -m pip install --no-cache-dir --default-timeout=100 newspaper3k RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then BRANCH=master; elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then BRANCH=aarch64; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then BRANCH=aarch64; else BRANCH=master; fi \ - && python3 -m pip install --no-cache-dir --default-timeout=100 -e git+git://github.com/DiegoPino/pycld2.git@${BRANCH}#egg=pycld2 + && python3 -m pip install --no-cache-dir --default-timeout=100 -e git+https://github.com/DiegoPino/pycld2.git@${BRANCH}#egg=pycld2 # RUN python3 -m pip install --no-cache-dir --default-timeout=100 -e git+git://github.com/DiegoPino/pycld2.git@aarch64#egg=pycld2 RUN python3 -m pip install --no-cache-dir --default-timeout=100 gensim RUN python3 -m pip install --no-cache-dir --default-timeout=100 pyicu numpy Flask morfessor langid BeautifulSoup4 afinn textblob From 08c96c8f56e3263cbcf078ba0ede737783090ce1 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 21 Apr 2022 02:20:04 +0100 Subject: [PATCH 3/9] Switch to nlpserver fork with FastText --- nlpserver/Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nlpserver/Dockerfile b/nlpserver/Dockerfile index 8ece0ff..7288794 100644 --- a/nlpserver/Dockerfile +++ b/nlpserver/Dockerfile @@ -12,9 +12,9 @@ RUN apt-get update && \ apt-get install -y curl supervisor WORKDIR /usr/src -RUN curl -L "https://github.com/web64/nlpserver/archive/v1.0.1.tar.gz" -O -RUN tar -xzf "v1.0.1.tar.gz" -RUN rm "v1.0.1.tar.gz" && mv nlpserver-1.0.1 nlpserver +RUN curl -L "https://github.com/digitaldogsbody/nlpserver-fasttext/archive/refs/tags/v1.0.2.tar.gz" -O +RUN tar -xzf "v1.0.2.tar.gz" +RUN rm "v1.0.2.tar.gz" && mv nlpserver-fasttext-1.0.2 nlpserver WORKDIR /usr/src/nlpserver RUN apt-get -y install pkg-config && \ @@ -31,6 +31,7 @@ RUN python3 -m pip install --no-cache-dir --default-timeout=100 pyicu numpy Flas RUN python3 -m pip install --no-cache-dir --default-timeout=100 spacy RUN python3 -m pip install --no-cache-dir --default-timeout=100 polyglot RUN python3 -m pip install --no-cache-dir --default-timeout=100 readability-lxml +RUN python3 -m pip install --no-cache-dir --default-timeout=100 git+https://github.com/facebookresearch/fastText.git # English, spanish and Italian # TODO add this as built time arguments @@ -49,6 +50,9 @@ RUN python3 -m spacy download en && \ python3 -m spacy download de && \ python3 -m spacy download it +# fasttext Language Detection Model +RUN curl -L "https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin" -O + # Supervisor COPY nlpserver.conf /etc/supervisor/conf.d COPY entrypoint.sh /usr/local/bin/ From 6bebd7df373588e3f292cbb74e9f1668d0545081 Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Thu, 5 May 2022 23:50:15 -0400 Subject: [PATCH 4/9] Cantaloupe Dev Snapshot (build on 6.0.0) with Grok Can be found on esmero/cantaloupe:6.0.0 properties file is only an example. --- esmero-cantaloupe/Dockerfile | 145 +++++------- esmero-cantaloupe/cantaloupe.properties | 278 +++++++++++++++--------- 2 files changed, 230 insertions(+), 193 deletions(-) diff --git a/esmero-cantaloupe/Dockerfile b/esmero-cantaloupe/Dockerfile index dade9cd..3f00491 100644 --- a/esmero-cantaloupe/Dockerfile +++ b/esmero-cantaloupe/Dockerfile @@ -3,7 +3,7 @@ # Also make sure you setup temp_pathname in cantaloupe.properties to a safe/stable place since Classes are cached there too. -FROM debian:buster-slim +FROM debian:bullseye-slim ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' @@ -61,23 +61,20 @@ ENV JAVA_HOME=/opt/java/openjdk \ # Publish new tag -- PRIVATE # $ docker login (user diegopino) use your own name folks! -# $ docker build . -t esmero/cantaloupe-s3:4.1.9 -# $ docker push esmero/cantaloupe-s3:4.1.9 -# If moving from Archipelago beta1 to beta3, see upgrading from 4.0.3 to 4.1.7 https://github.com/cantaloupe-project/cantaloupe/blob/develop/UPGRADING.md#40x--41 - -ENV CANTALOUPE_VERSION 4.1.10 -ENV PKGNAME=graphicsmagick -# 1.3.35 (Released Febr 23, 2020) -ENV PKGVER=1.3.35 -# Uses 50% of the memory of 16. Use 16 if dealing with 48/64 bit pixels color -ENV QUANTUMDEPTH=8 -ENV PKGSOURCE=http://downloads.sourceforge.net/$PKGNAME/$PKGNAME/$PKGVER/GraphicsMagick-$PKGVER.tar.lz +# $ docker build . -t esmero/cantaloupe-s3:6.0.0 +# $ docker push esmero/cantaloupe-s3:6.0.0 +# If moving from Archipelago RC3, see upgrading from 4.1 to 5.x https://github.com/cantaloupe-project/cantaloupe/blob/develop/UPGRADING.md#41x--50 +# and https://github.com/cantaloupe-project/cantaloupe/blob/develop/UPGRADING.md#50--60 + + +ENV CANTALOUPE_VERSION 6.0.0 EXPOSE 8182 RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ wget \ + nasm \ libopenjp2-tools \ libopenjp2-7-dev \ liblcms2-dev \ @@ -85,7 +82,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libzstd-dev \ libtiff-dev \ libjpeg-dev \ - libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential \ + libcairo2-dev libpango1.0-dev libgif-dev build-essential \ zlib1g-dev \ libwebp-dev \ libimage-exiftool-perl \ @@ -99,35 +96,41 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ zlib1g zlib1g-dev libxml2 libxml2-dev libltdl-dev libpng-dev libtool libopenjp2-7 libtiff-dev cmake automake autoconf make gcc g++ libimage-exiftool-perl libfreetype6-dev \ && rm -rf /var/lib/apt/lists/* -# Install TurboJpegProcessor dependencies -RUN mkdir -p /opt/libjpeg-turbo/lib - -# Graphicsmagick dependencies -#RUN apk add --no-cache --update g++ \ -# gcc \ -# make \ -# automake \ -# autoconf \ -# git \ -# lzip \ -# wget \ -# sdl-dev \ -# giflib-dev \ -# libjpeg-turbo-dev \ -# lcms2-dev \ -# libwmf-dev \ -# jasper-dev \ -# libx11-dev \ -# libpng-dev \ -# libtool \ -# jasper-dev \ -# bzip2-dev \ -# zlib-dev \ -# libxml2-dev \ -# tiff-dev \ -# exiftool \ -# freetype-dev \ -# libgomp +# Install TurboJpegProcessor +WORKDIR /tmp +RUN curl -OL https://sourceforge.net/projects/libjpeg-turbo/files/2.0.1/libjpeg-turbo-2.0.1.tar.gz \ + && tar xzvf libjpeg-turbo-2.0.1.tar.gz \ + && cd libjpeg-turbo-2.0.1 \ + && mkdir BUILD && cd BUILD \ + && cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_JAVA=1 \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_STATIC=FALSE \ + -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/libjpeg-turbo-2.0.1 \ + -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib \ + .. \ + && make \ + && make install + +# Install GrokIMageCompression + +WORKDIR /tmp + + +#RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 + + +RUN curl -OL https://github.com/GrokImageCompression/grok/archive/refs/tags/v9.7.6.tar.gz \ + && tar xzvf v9.7.6.tar.gz \ + && cd grok-9.7.6 \ + && mkdir BUILD && cd BUILD \ + && cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/grok-9.7.6 \ + -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib \ + .. \ + && make \ + && make install WORKDIR /tmp @@ -145,63 +148,23 @@ RUN curl -OL https://github.com/jasper-software/jasper/archive/version-2.0.32/ja && make test \ && make install -WORKDIR /tmp -RUN wget $PKGSOURCE && \ - lzip -d -c GraphicsMagick-$PKGVER.tar.lz | tar -xvf - && \ - cd GraphicsMagick-$PKGVER && \ - ./configure \ - --build=$CBUILD \ - --host=$CHOST \ - --prefix=/usr \ - --sysconfdir=/etc \ - --enable-magick-compat \ - --mandir=/usr/share/man \ - --infodir=/usr/share/info \ - --localstatedir=/var \ - --enable-shared \ - --disable-static \ - --with-modules \ - --with-threads \ - --with-webp=yes \ - --with-tiff=yes \ - --with-jpeg=yes \ - --with-jp2=yes \ - --with-png=yes \ - --with-xml=yes \ - --with-wmf=yes \ - --with-ttf \ - --with-gs-font-dir=/usr/share/fonts/Type1 \ - --with-quantum-depth=$QUANTUMDEPTH && \ - make && \ - make install && \ - cd /tmp && \ - rm -rf GraphicsMagick-$PKGVER && \ - rm GraphicsMagick-$PKGVER.tar.lz - - # Cantaloupe WORKDIR /tmp RUN apt-get update && apt-get install -y --no-install-recommends maven unzip -RUN curl -OL https://github.com/cantaloupe-project/cantaloupe/archive/refs/heads/release/4.1.zip \ - && mkdir -p /usr/local/ \ - && cd /usr/local \ - && unzip /tmp/4.1.zip && cd cantaloupe-release-4.1 && mvn clean package -DskipTests \ - && mv target/cantaloupe-4.1.10-SNAPSHOT.zip /usr/local/ \ - && cd /usr/local \ - && unzip cantaloupe-4.1.10-SNAPSHOT.zip \ - && ln -s cantaloupe-4.1.10-SNAPSHOT cantaloupe \ - && rm -rf /tmp/4.1.zip \ - && rm -rf /usr/local/cantaloupe-4.1.10-SNAPSHOT.zip \ - && rm -rf /usr/local/cantaloupe-release-4.1 \ - && ls /usr/local/cantaloupe/cantaloupe-* \ +RUN git clone https://github.com/cantaloupe-project/cantaloupe.git /usr/local/cantaloupe-build && cd /usr/local/cantaloupe-build && git checkout develop \ + && cp /usr/local/cantaloupe-build/dist/deps/Linux-x86-64/lib/*.so /usr/lib/ \ + && mvn clean package -DskipTests \ + && mkdir /usr/local/cantaloupe/ \ && mkdir -p /etc/cantaloupe +RUN cp /usr/local/cantaloupe-build/target/cantaloupe-6.0-SNAPSHOT.jar /usr/local/cantaloupe/cantaloupe-6.0-SNAPSHOT.jar +RUN rm -rf /usr/local/cantaloupe-build/ ARG user=cantaloupe ARG home=/home/$user -RUN adduser --home $home $user +RUN adduser -u 8183 --home $home $user RUN chown -R $user $home # upcoming docker releases: use --chown=cantaloupe @@ -221,8 +184,6 @@ ENV XMX=${XMX} USER $user - - VOLUME ["/var/log/cantaloupe", "/var/cache/cantaloupe"] -CMD ["sh", "-c", "java -Dcantaloupe.config=/etc/cantaloupe/cantaloupe.properties -Xms${XMS} -Xmx${XMX} -jar /usr/local/cantaloupe/cantaloupe-4.1.10-SNAPSHOT.war"] +CMD ["sh", "-c", "java -Dcantaloupe.config=/etc/cantaloupe/cantaloupe.properties -Xms${XMS} -Xmx${XMX} -jar /usr/local/cantaloupe/cantaloupe-6.0-SNAPSHOT.jar"] diff --git a/esmero-cantaloupe/cantaloupe.properties b/esmero-cantaloupe/cantaloupe.properties index 1317168..b496e26 100644 --- a/esmero-cantaloupe/cantaloupe.properties +++ b/esmero-cantaloupe/cantaloupe.properties @@ -17,14 +17,11 @@ temp_pathname = http.enabled = true http.host = 0.0.0.0 http.port = 8182 -http.http2.enabled = false # !! Configures the HTTPS server. (Standalone mode only.) https.enabled = false https.host = 0.0.0.0 https.port = 8183 -# Secure HTTP/2 requires Java 9 or later. -https.http2.enabled = false # !! Available values are `JKS` and `PKCS12`. (Standalone mode only.) https.key_store_type = JKS @@ -32,8 +29,12 @@ https.key_store_password = myPassword https.key_store_path = /path/to/keystore.jks https.key_password = myPassword -# !! Maximum size of the HTTP(S) request queue. Leave blank to use the -# default. +# !! Constrains the size of the web server's thread pool. Leave blank to +# use the defaults. +http.min_threads = +http.max_threads = + +# !! Maximum size of the request queue. Leave blank to use the default. http.accept_queue_limit = # Base URI to use for internal links, such as Link headers and JSON-LD @@ -51,12 +52,29 @@ slash_substitute = # Maximum number of pixels to return in a response, to prevent overloading # the server. Requests for more pixels than this will receive an error # response. Set to 0 for no maximum. -max_pixels = 400000000 +max_pixels = 40000000 # Maximum scale to allow (1.0 = full scale; 0 = no maximum). max_scale = 1.0 -# Errors will also be logged to the error log (if enabled). +# A meta-identifier is a superset of an identifier that includes other +# information like a page number and/or scale constraint. A meta-identifier +# transformer transforms a meta-identifier to and from a string in a URI +# path component. +# Available transformers include `StandardMetaIdentifierTransformer` and +# `DelegateMetaIdentifierTransformer`. See the user manual for more +# information about meta-identifiers and these options. +meta_identifier.transformer = StandardMetaIdentifierTransformer + +# Character sequence that separates the components of a meta-identifier in +# the identifier portion of a URI. +meta_identifier.transformer.StandardMetaIdentifierTransformer.delimiter = ; + +# If true, HTTP >= 400-level responses are logged at WARN and ERROR level. +# This may result in multiple log statements for the same error, but it may +# also help diagnose errors that have evaded logging. +log_error_responses = false + print_stack_trace_on_error_pages = true ########################################################################### @@ -70,12 +88,10 @@ delegate_script.enabled = false # !! This can be an absolute path, or a filename; if only a filename is # specified, it will be searched for in the same folder as this file, and # then the current working directory. +# The delegate script pathname can also be set using the +# -Dcantaloupe.delegate_script VM argument, which overrides this value. delegate_script.pathname = delegates.rb -# Enables the invocation cache, which caches method invocations and return -# values in memory. See the user manual for more information. -delegate_script.cache.enabled = false - ########################################################################### # ENDPOINTS ########################################################################### @@ -86,10 +102,8 @@ endpoint.iiif.1.enabled = false # Enables the IIIF Image API 2.x endpoint, at /iiif/2. endpoint.iiif.2.enabled = true -# Controls the response Content-Disposition header for images. Allowed -# values are `inline`, `attachment`, and `none`. This can be overridden -# using the ?response-content-disposition query argument. -endpoint.iiif.content_disposition = inline +# Enables the IIIF Image API 3.x endpoint, at /iiif/3. +endpoint.iiif.3.enabled = true # Minimum size that will be used in info.json `sizes` keys. endpoint.iiif.min_size = 64 @@ -100,7 +114,7 @@ endpoint.iiif.min_tile_size = 512 # If true, requests for sizes other than those contained in an information # response will be denied. -endpoint.iiif.2.restrict_to_sizes = false +endpoint.iiif.restrict_to_sizes = false # Enables the Control Panel, at /admin. endpoint.admin.enabled = true @@ -108,11 +122,19 @@ endpoint.admin.username = admin endpoint.admin.secret = archipelago # Enables the administrative HTTP API. (See the user manual.) -endpoint.api.enabled = false +endpoint.api.enabled = true # HTTP Basic credentials to access the HTTP API. -endpoint.api.username = -endpoint.api.secret = +endpoint.api.username = admin +endpoint.api.secret = archipelago + +# Enables the health check endpoint, at /health. +endpoint.health.enabled = true + +# If true, sources and caches will be checked, resulting in a more robust +# but slower health check. Set this to false if these services already have +# their own health checks. +endpoint.health.dependency_check = false ########################################################################### # SOURCES @@ -153,6 +175,10 @@ HttpSource.allow_insecure = false # Request timeout in seconds. HttpSource.request_timeout = +# !! Client HTTP proxy. +HttpSource.proxy.http.host = +HttpSource.proxy.http.port = + # Tells HttpSource how to look up resources. Allowed values are # `BasicLookupStrategy` and `ScriptLookupStrategy`. ScriptLookupStrategy # uses a delegate method for dynamic lookups; see the user manual. @@ -170,6 +196,12 @@ HttpSource.BasicLookupStrategy.url_suffix = HttpSource.BasicLookupStrategy.auth.basic.username = HttpSource.BasicLookupStrategy.auth.basic.secret = +# Before an image is retrieved, a preliminary request is sent to check +# various characteristics. Typically this is a HEAD request, but some +# resources, such as those using pre-signed URLs, may not support HEAD +# requests. This key enables a ranged GET request to be sent instead. +HttpSource.BasicLookupStrategy.send_head_requests = true + # Read data in chunks when it may be more efficient. (This also may end up # being less efficient, depending on many variables; see the user manual.) HttpSource.chunking.enabled = true @@ -188,30 +220,30 @@ HttpSource.chunking.cache.max_size = 5M # S3Source #---------------------------------------- -# !! Endpoint URI. -# For AWS endpoints, see: -# https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region -S3Source.endpoint = +# !! Endpoint URI. Only needed for non-AWS endpoints. +S3Source.endpoint = http://esmero-minio:9000 + +# !! AWS region. Only needed for AWS endpoints. +S3Source.region = us-east-2 # !! Credentials for your AWS account. # See: http://aws.amazon.com/security-credentials # Note that this info can be obtained from elsewhere rather than setting # it here; see the user manual. +S3Source.access_key_id = minio +S3Source.secret_key = minio123 -S3Source.access_key_id = -S3Source.secret_key = - -# Tells S3Source how to look up objects. Allowed values are -# `BasicLookupStrategy` and `ScriptLookupStrategy`. ScriptLookupStrategy -# uses a delegate method for dynamic lookups; see the user manual. +# How to look up objects. Allowed values are `BasicLookupStrategy` and +# `ScriptLookupStrategy`. ScriptLookupStrategy uses a delegate method for +# dynamic lookups; see the user manual. S3Source.lookup_strategy = BasicLookupStrategy # !! Name of the bucket containing images to be served. -S3Source.BasicLookupStrategy.bucket.name = +S3Source.BasicLookupStrategy.bucket.name = archipelago # Path within the bucket that will be prefixed to the identifier in the URL. # Trailing slash is important! -S3Source.BasicLookupStrategy.path_prefix = / +S3Source.BasicLookupStrategy.path_prefix = # Path or extension that will be suffixed to the identifier in the URL. S3Source.BasicLookupStrategy.path_suffix = @@ -230,6 +262,59 @@ S3Source.chunking.cache.enabled = true # Max per-request chunk cache size. S3Source.chunking.cache.max_size = 5M +#---------------------------------------- +# AzureStorageSource +#---------------------------------------- + +# !! Name of your Azure account. +# Leave blank if using URI with a SAS token in your object key. +AzureStorageSource.account_name = + +# !! Key of your Azure account. +# Leave blank if using URI with a SAS token in your object key. +AzureStorageSource.account_key = + +# !! Name of the container containing images to be served. +# Leave blank if using URI with the container in your object key. +AzureStorageSource.container_name = + +# Tells AzureStorageSource how to look up objects. Allowed values are +# `BasicLookupStrategy` and `ScriptLookupStrategy`. ScriptLookupStrategy +# uses a delegate method for dynamic lookups; see the user manual. +AzureStorageSource.lookup_strategy = BasicLookupStrategy + +# Read data in chunks when it may be more efficient. (This also may end up +# being less efficient, depending on many variables; see the user manual.) +AzureStorageSource.chunking.enabled = true + +# Chunk size. +AzureStorageSource.chunking.chunk_size = 512K + +# The per-request chunk cache caches downloaded chunks in memory during +# a request, and clears them when the request is complete. +AzureStorageSource.chunking.cache.enabled = true + +# Max per-request chunk cache size. +AzureStorageSource.chunking.cache.max_size = 5M + +#---------------------------------------- +# JdbcSource +#---------------------------------------- + +# Note: JdbcSource requires some delegate methods to be implemented in +# addition to the configuration here, and a JDBC driver to be installed on +# the classpath; see the user manual. + +# !! +JdbcSource.url = jdbc:postgresql://localhost:5432/my_database +# !! +JdbcSource.user = postgres +# !! +JdbcSource.password = postgres + +# !! Connection timeout in seconds. +JdbcSource.connection_timeout = 10 + ########################################################################### # PROCESSORS ########################################################################### @@ -243,29 +328,29 @@ S3Source.chunking.cache.max_size = 5M # dependencies. # * If set to `ManualSelectionStrategy`, a processor will be chosen based # on the rest of the keys in this section. -processor.selection_strategy = ManualSelectionStrategy +processor.selection_strategy = AutomaticSelectionStrategy +# Built-in processors are `Java2dProcessor`, TurboJpegProcessor`, +# `KakaduNativeProcessor`, `OpenJpegProcessor`, `GrokProcessor`,`JaiProcessor`, +# `PdfBoxProcessor`, and `FfmpegProcessor`. +# Some of these have third-party dependencies and won't work out-of-the-box. -# Image processors to use for various source formats. Available values are -# `Java2dProcessor`, `GraphicsMagickProcessor`, `ImageMagickProcessor`, -# `KakaduDemoProcessor`, `KakaduNativeProcessor`, `OpenJpegProcessor`, -# `JaiProcessor`, `PdfBoxProcessor`, and `FfmpegProcessor`. - -# These extension-specific definitions are optional. +# These format-specific definitions are optional. processor.ManualSelectionStrategy.avi = FfmpegProcessor processor.ManualSelectionStrategy.bmp = -processor.ManualSelectionStrategy.dcm = GraphicsMagickProcessor processor.ManualSelectionStrategy.flv = FfmpegProcessor processor.ManualSelectionStrategy.gif = -processor.ManualSelectionStrategy.jp2 = OpenJpegProcessor +processor.ManualSelectionStrategy.jp2 = GrokProcessor processor.ManualSelectionStrategy.jpg = TurboJpegProcessor processor.ManualSelectionStrategy.mov = FfmpegProcessor processor.ManualSelectionStrategy.mp4 = FfmpegProcessor +processor.ManualSelectionStrategy.mv4 = FfmpegProcessor processor.ManualSelectionStrategy.mpg = FfmpegProcessor processor.ManualSelectionStrategy.pdf = PdfBoxProcessor processor.ManualSelectionStrategy.png = Java2dProcessor processor.ManualSelectionStrategy.tif = Java2dProcessor processor.ManualSelectionStrategy.webm = FfmpegProcessor +processor.ManualSelectionStrategy.xpm = # Fall back to this processor for any formats not assigned above. processor.ManualSelectionStrategy.fallback = Java2dProcessor @@ -290,6 +375,10 @@ processor.stream_retrieval_strategy = StreamStrategy # * `AbortStrategy` causes the request to fail. processor.fallback_retrieval_strategy = CacheStrategy +# If true, images stored in the source cache for which no format can be +# inferred will be purged. +processor.purge_incompatible_from_source_cache = true + # Resolution of vector rasterization (of e.g. PDFs) at a scale of 1. processor.dpi = 150 @@ -304,17 +393,14 @@ processor.background_color = white processor.downscale_filter = bicubic processor.upscale_filter = bicubic +# If true, images are downscaled in a linear color space, which is more +# accurate. This only works with mono-resolution (non-pyramidal) images. It +# also may impair performance. +processor.downscale_linear = false + # Intensity of an unsharp mask from 0 to 1. processor.sharpen = 0 -# Attempts to copy source image metadata (EXIF, IPTC, XMP) into derivative -# images. (This is not foolproof; see the user manual.) -processor.metadata.preserve = false - -# Whether to auto-rotate images using the EXIF `Orientation` field. -# The check for this field can impair performance slightly. -processor.metadata.respect_orientation = false - # Progressive JPEGs are usually more compact. processor.jpg.progressive = true @@ -340,6 +426,7 @@ processor.imageio.png.reader = processor.imageio.png.writer = processor.imageio.tif.reader = processor.imageio.tif.writer = +processor.imageio.xpm.reader = #---------------------------------------- # FfmpegProcessor @@ -347,39 +434,33 @@ processor.imageio.tif.writer = # Optional absolute path of the directory containing the FFmpeg binaries. # Overrides the PATH. -FfmpegProcessor.path_to_binaries = /usr/bin - -#---------------------------------------- -# GraphicsMagickProcessor -#---------------------------------------- - -# !! Optional absolute path of the directory containing the GraphicsMagick -# binary. Overrides the PATH. -GraphicsMagickProcessor.path_to_binaries = /usr/bin +FfmpegProcessor.path_to_binaries = #---------------------------------------- -# ImageMagickProcessor +# OpenJpegProcessor #---------------------------------------- -# !! Optional absolute path of the directory containing the ImageMagick -# binary. Overrides the PATH. -ImageMagickProcessor.path_to_binaries = +# Optional absolute path of the directory containing opj_decompress. +# Overrides the PATH. +OpenJpegProcessor.path_to_binaries = #---------------------------------------- -# KakaduDemoProcessor +# GrokProcessor #---------------------------------------- -# Optional absolute path of the directory containing kdu_expand. +# Optional absolute path of the directory containing grk_decompress. # Overrides the PATH. -KakaduDemoProcessor.path_to_binaries = +GrokProcessor.path_to_binaries = #---------------------------------------- -# OpenJpegProcessor +# PdfBoxProcessor #---------------------------------------- -# Optional absolute path of the directory containing opj_decompress. -# Overrides the PATH. -OpenJpegProcessor.path_to_binaries = +# The following will enable disk to be used as well as memory during +# PDF loading in PdfBoxProcessor. If `max_memory_bytes` is -1 it +# will use unlimited memory. +processor.pdf.scratch_file_enabled = true +processor.pdf.max_memory_bytes = -1 ########################################################################### # CLIENT-SIDE CACHING @@ -414,11 +495,11 @@ cache.server.source = FilesystemCache cache.server.source.ttl_seconds = 2592000 # Enables the derivative (processed image) cache. -cache.server.derivative.enabled = true +cache.server.derivative.enabled = false # Available values are `FilesystemCache`, `JdbcCache`, `RedisCache`, # `HeapCache`, `S3Cache`, and `AzureStorageCache`. -cache.server.derivative = FilesystemCache +cache.server.derivative = S3Cache # Amount of time derivative cache content remains valid. Set to blank or 0 # for forever. @@ -432,7 +513,7 @@ cache.server.info.enabled = true # missing, all cached information relating to it (if any) will be deleted. # (This is effectively always false when cache.server.resolve_first is also # false.) -cache.server.purge_missing = true +cache.server.purge_missing = false # If true, the source image will be confirmed to exist before a cached copy # is returned. If false, the cached copy will be returned without checking. @@ -441,7 +522,7 @@ cache.server.resolve_first = false # !! Enables the cache worker, which periodically purges invalid cache # items in the background. -cache.server.worker.enabled = true +cache.server.worker.enabled = false # !! The cache worker will wait this many seconds before starting its # next shift. @@ -504,27 +585,24 @@ JdbcCache.info_table = info_cache # S3Cache #---------------------------------------- -# !! Endpoint URI. -# For AWS endpoints, see: -# https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region -S3Cache.endpoint = +# !! Endpoint URI. Only needed for non-AWS endpoints. +S3Cache.endpoint = http://esmero-minio:9000 + +# !! AWS region. Only needed for AWS endpoints. +S3Cache.region = us-east-2 # !! Credentials for your AWS account. # See: http://aws.amazon.com/security-credentials # Note that this info can be obtained from elsewhere rather than setting it # here; see the user manual. -S3Cache.access_key_id = -S3Cache.secret_key = +S3Cache.access_key_id = minio +S3Cache.secret_key = minio123 # !! Name of a bucket to use to hold cached data. -S3Cache.bucket.name = +S3Cache.bucket.name = archipelago # !! String that will be prefixed to object keys. -S3Cache.object_key_prefix = - -# !! Maximum number of concurrent HTTP connections to AWS. Leave blank to -# use the default. -S3Cache.max_connections = +S3Cache.object_key_prefix = iiifcache #---------------------------------------- # AzureStorageCache @@ -555,14 +633,14 @@ RedisCache.database = 0 # OVERLAYS ########################################################################### -# Whether to enable overlays. -overlays.enabled = false - # Controls how overlays are configured. `BasicStrategy` will use the # `overlays.BasicStrategy.*` keys in this section. `ScriptStrategy` will # use a delegate method. (See the user manual.) overlays.strategy = BasicStrategy +# Whether to enable overlays using the BasicStrategy. +overlays.BasicStrategy.enabled = false + # `image` or `string`. overlays.BasicStrategy.type = image @@ -570,9 +648,9 @@ overlays.BasicStrategy.type = image overlays.BasicStrategy.image = /path/to/overlay.png # Overlay text. -overlays.BasicStrategy.string = Copyright \u00A9\u00EF\u00B8\u008F My Great Organization\nAll rights reserved. +overlays.BasicStrategy.string = Copyright © My Great Organization\nAll rights reserved. -# For possible values, launch with the -Dcantaloupe.list_fonts option. +# For a list of possible values, launch with the -list-fonts argument. overlays.BasicStrategy.string.font = Helvetica # Font size in points. @@ -603,10 +681,12 @@ overlays.BasicStrategy.string.stroke.width = 1 overlays.BasicStrategy.string.background.color = rgba(0, 0, 0, 100) # Allowed values: `top left`, `top center`, `top right`, `left center`, -# `center`, `right center`, `bottom left`, `bottom center`, `bottom right`. +# `center`, `right center`, `bottom left`, `bottom center`, `bottom right`, +# `repeat` (images only), `scaled` (images only). overlays.BasicStrategy.position = bottom right -# Pixel margin between the overlay and the image edge. +# Pixel margin between the overlay and the image edge. Does not apply to +# `repeat` position. overlays.BasicStrategy.inset = 10 # Output images less than this many pixels wide will not receive an overlay. @@ -617,13 +697,6 @@ overlays.BasicStrategy.output_width_threshold = 400 # Set to 0 to add the overlay regardless. overlays.BasicStrategy.output_height_threshold = 300 -########################################################################### -# REDACTIONS -########################################################################### - -# See the user manual for information about how redactions work. -redaction.enabled = false - ########################################################################### # LOGGING ########################################################################### @@ -633,15 +706,18 @@ redaction.enabled = false #---------------------------------------- # `trace`, `debug`, `info`, `warn`, `error`, `all`, or `off` -log.application.level = trace +log.application.level = info log.application.ConsoleAppender.enabled = true +log.application.ConsoleAppender.logstash.enabled = false # N.B.: Don't enable FileAppender and RollingFileAppender simultaneously! log.application.FileAppender.enabled = false +log.application.FileAppender.logstash.enabled = false log.application.FileAppender.pathname = /path/to/logs/application.log log.application.RollingFileAppender.enabled = false +log.application.RollingFileAppender.logstash.enabled = false log.application.RollingFileAppender.pathname = /path/to/logs/application.log log.application.RollingFileAppender.policy = TimeBasedRollingPolicy log.application.RollingFileAppender.TimeBasedRollingPolicy.filename_pattern = /path/to/logs/application-%d{yyyy-MM-dd}.log @@ -663,9 +739,11 @@ log.application.SyslogAppender.facility = LOCAL0 # N.B.: Don't enable FileAppender and RollingFileAppender simultaneously! log.error.FileAppender.enabled = false +log.error.FileAppender.logstash.enabled = false log.error.FileAppender.pathname = /path/to/logs/error.log log.error.RollingFileAppender.enabled = false +log.error.RollingFileAppender.logstash.enabled = false log.error.RollingFileAppender.pathname = /path/to/logs/error.log log.error.RollingFileAppender.policy = TimeBasedRollingPolicy log.error.RollingFileAppender.TimeBasedRollingPolicy.filename_pattern = /path/to/logs/error-%d{yyyy-MM-dd}.log @@ -695,5 +773,3 @@ log.access.SyslogAppender.enabled = false log.access.SyslogAppender.host = log.access.SyslogAppender.port = 514 log.access.SyslogAppender.facility = LOCAL0 -processor.webp = -processor.ManualSelectionStrategy.webp= From f155bbd99c0a0f73c7b32f75e7413448256c90e0 Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Wed, 3 Aug 2022 10:48:37 -0400 Subject: [PATCH 5/9] Fix Drush on PHP 8 to avoid phpdotenv error Also build image magick 7 with JP2 support (for identify). This all matches the live/published container esmero/php-8.0-fpm:1.0.0-multiarch --- esmero-php-fpm/Dockerfile | 69 +++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index 153e64a..729d8ef 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -247,11 +247,10 @@ WORKDIR /usr/src/ RUN cd /usr/src && curl -sS http://getcomposer.org/installer | php RUN cd /usr/src && mv composer.phar /usr/bin/composer && composer self-update && composer self-update --2 -# Installation of drush -RUN git clone https://github.com/drush-ops/drush.git /usr/local/src/drush -RUN cd /usr/local/src/drush && git checkout 11.0.5 -RUN ln -s /usr/local/src/drush/drush /usr/bin/drush -RUN cd /usr/local/src/drush && composer update && composer install +WORKDIR /usr/bin/ +# Installation of drush launcher / Drush will be installed via composer later +RUN wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar +RUN chmod +x drush.phar && mv drush.phar drush # Install Fido RUN cd /usr/src && wget https://github.com/openpreserve/fido/archive/v1.4.1.zip && unzip v1.4.1.zip \ @@ -260,7 +259,8 @@ RUN cd /usr/src/fido-1.4.1 && ./setup.py install # Install WACZ RUN set -eux; \ - apk add --no-cache --virtual .build-deps-py \ +\ + apk update && apk add --no-cache --virtual .build-deps-py \ gcc \ python3-dev \ py3-pip \ @@ -271,8 +271,65 @@ RUN set -eux; \ cd /usr/local/src/wacz/ && git checkout main && \ pip3 install -r requirements.txt && chmod 755 setup.py && ./setup.py install +# Build Image Magick with JP2 Support +RUN set -eux; \ + apk update && apk add --no-cache --virtual .build-deps-imagemagick \ + openjpeg-dev \ + chrpath \ + fontconfig-dev \ + freetype-dev \ + ghostscript-dev \ + lcms2-dev \ + libheif-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libtool \ + libwebp-dev \ + libx11-dev \ + libxext-dev \ + libxml2-dev \ + perl-dev \ + tiff-dev \ + zlib-dev \ + libraw-dev \ + make \ + openexr-dev \ + libwmf-dev \ + libltdl \ + graphviz-dev \ + bzip2-dev \ + pango-dev \ + libzip-dev \ + alpine-sdk \ + linux-headers \ + musl-dev \ + && cd /usr/local/src/ \ + && wget https://download.imagemagick.org/ImageMagick/download/ImageMagick-7.1.0-31.tar.gz \ + && tar xzvf ImageMagick-7.1.0-31.tar.gz && rm ImageMagick-7.1.0-31.tar.gz && cd ImageMagick-7.1.0-31 && \ + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --enable-static \ + --disable-openmp \ + --with-threads \ + --with-x \ + --with-tiff \ + --with-png \ + --with-webp \ + --with-gslib \ + --with-gs-font-dir=/usr/share/fonts/Type1 \ + --with-heic \ + --with-modules \ + --with-xml \ + --with-perl \ + --with-perl-options="PREFIX=/usr INSTALLDIRS=vendor" \ + && make && make install; \ + apk del .build-deps-imagemagick; + #Clean up sources, we need to keep drush one RUN rm -rf /usr/local/src/wacz +RUN rm -rf /usr/local/src/ImageMagick-7.1.0-31 RUN rm -rf /usr/local/src/tesseract RUN rm -rf /usr/src/pdfalto RUN rm -rf /usr/src/xpdf From 5b88dd39c307932f843976245e4d06a3d227cd16 Mon Sep 17 00:00:00 2001 From: aksm Date: Wed, 3 Aug 2022 16:44:09 -0400 Subject: [PATCH 6/9] Add PHP intl extension and dependencies, i.e. icu-dev. --- esmero-php-fpm/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index 729d8ef..9c33671 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -44,6 +44,7 @@ RUN set -eux; \ imagemagick \ imagemagick-libs \ imagemagick-dev \ + icu-dev \ ; \ \ docker-php-ext-configure gd \ @@ -51,6 +52,8 @@ RUN set -eux; \ --with-jpeg=/usr/include \ ; \ \ + docker-php-ext-configure intl; \ + \ docker-php-ext-install -j "$(nproc)" \ gd \ zip \ @@ -63,6 +66,7 @@ RUN set -eux; \ pgsql \ pdo_pgsql \ bcmath \ + intl \ ; \ \ runDeps="$( \ @@ -80,6 +84,7 @@ RUN set -eux; \ docker-php-ext-enable apcu; \ docker-php-ext-enable pcntl; \ docker-php-ext-enable redis.so; \ + docker-php-ext-enable intl; \ apk del .build-deps # set recommended PHP.ini settings From ecfbf73b25c1859468d70407c1e83169d9b98a05 Mon Sep 17 00:00:00 2001 From: aksm Date: Wed, 10 Aug 2022 16:41:52 -0400 Subject: [PATCH 7/9] Update dev Dockerfile with new base image, xdebug settings, and config filename. --- esmero-php-fpm/Dockerfile.dev | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/esmero-php-fpm/Dockerfile.dev b/esmero-php-fpm/Dockerfile.dev index cee4083..408087c 100644 --- a/esmero-php-fpm/Dockerfile.dev +++ b/esmero-php-fpm/Dockerfile.dev @@ -1,8 +1,8 @@ # build with: -# sudo docker build -f Dockerfile.dev -t esmero/php-8.0-fpm:1.0.0-dev-multiarch . --no-cache +# sudo docker build -f Dockerfile.dev -t esmero/php-8.0-fpm:1.1.0-dev-multiarch . --no-cache # from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements -FROM esmero/php-8.0-fpm:1.0.0-multiarch +FROM esmero/php-8.0-fpm:1.1.0-multiarch # install the extensions we need for xdebug install RUN set -eux; \ @@ -15,16 +15,14 @@ RUN set -eux; \ apk del --no-cache .build-deps RUN { \ - echo 'zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so'; \ - echo 'xdebug.remote_enable=1'; \ + echo 'zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so'; \ echo 'xdebug.remote_handler=dbgp'; \ - echo 'xdebug.remote_port=9999'; \ - echo 'xdebug.remote_autostart=0'; \ - echo 'xdebug.remote_connect_back=0'; \ - echo 'xdebug.remote_timeout=500'; \ - echo 'xdebug.profiler_enable = 0'; \ - echo 'xdebug.profiler_enable_trigger = 1'; \ + echo 'xdebug.client_port=9999'; \ + echo 'xdebug.start_with_request=yes'; \ + echo 'xdebug.connect_timeout_ms=500'; \ + echo 'xdebug.mode=develop,debug'; \ + echo 'xdebug.start_with_request=trigger'; \ echo 'xdebug.idekey=archipelago'; \ - echo "xdebug.remote_host=host.docker.internal"; \ - echo "xdebug.remote_log=/tmp/xdebug.log"; \ - } > /usr/local/etc/php/conf.d/xdebug.ini + echo "xdebug.client_host=host.docker.internal"; \ + echo "xdebug.log=/tmp/xdebug.log"; \ + } > /usr/local/etc/php/conf.d/10-xdebug.ini From 933eba33159caa001d9d2e667980d08bf1e92597 Mon Sep 17 00:00:00 2001 From: aksm Date: Thu, 11 Aug 2022 09:58:19 -0400 Subject: [PATCH 8/9] Clean up duplicate setting. --- esmero-php-fpm/Dockerfile.dev | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esmero-php-fpm/Dockerfile.dev b/esmero-php-fpm/Dockerfile.dev index 408087c..ea1f416 100644 --- a/esmero-php-fpm/Dockerfile.dev +++ b/esmero-php-fpm/Dockerfile.dev @@ -17,11 +17,10 @@ RUN set -eux; \ RUN { \ echo 'zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so'; \ echo 'xdebug.remote_handler=dbgp'; \ - echo 'xdebug.client_port=9999'; \ + echo 'xdebug.client_port=9003'; \ echo 'xdebug.start_with_request=yes'; \ echo 'xdebug.connect_timeout_ms=500'; \ echo 'xdebug.mode=develop,debug'; \ - echo 'xdebug.start_with_request=trigger'; \ echo 'xdebug.idekey=archipelago'; \ echo "xdebug.client_host=host.docker.internal"; \ echo "xdebug.log=/tmp/xdebug.log"; \ From bbe87ac54b1bee52055df3fbe12bb807d3f89e03 Mon Sep 17 00:00:00 2001 From: aksm Date: Mon, 31 Oct 2022 10:44:07 -0400 Subject: [PATCH 9/9] Update to PHP 8.0.24 --- esmero-php-fpm/Dockerfile | 2 +- esmero-php-fpm/Dockerfile.dev | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index 9c33671..fea2ff0 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -1,5 +1,5 @@ # from https://www.drupal.org/docs/9/system-requirements/drupal-9-php-requirements -FROM php:8.0.16-fpm-alpine3.15 +FROM php:8.0.24-fpm-alpine3.15 # install the PHP extensions we need # postgresql-dev is needed for https://bugs.alpinelinux.org/issues/3642 diff --git a/esmero-php-fpm/Dockerfile.dev b/esmero-php-fpm/Dockerfile.dev index cee4083..7093c0b 100644 --- a/esmero-php-fpm/Dockerfile.dev +++ b/esmero-php-fpm/Dockerfile.dev @@ -1,8 +1,8 @@ # build with: -# sudo docker build -f Dockerfile.dev -t esmero/php-8.0-fpm:1.0.0-dev-multiarch . --no-cache +# sudo docker build -f Dockerfile.dev -t esmero/php-8.0.24-fpm:1.0.0-dev-multiarch . --no-cache # from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements -FROM esmero/php-8.0-fpm:1.0.0-multiarch +FROM esmero/php-8.0.24-fpm:1.1.0-multiarch # install the extensions we need for xdebug install RUN set -eux; \