From 1565cbaa15014949e5fc75f51f57dda04001b8dc Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Fri, 3 Jan 2020 13:08:55 -0500 Subject: [PATCH 1/3] adds build essentials, poppler utils, exiftool and fido --- esmero-php-fpm/Dockerfile | 136 +++++++++++++++++++++++++++++++++----- 1 file changed, 121 insertions(+), 15 deletions(-) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index 6fbfa65..b5ab0cc 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -7,7 +7,7 @@ RUN set -eux; \ \ apk add --no-cache --virtual .build-deps \ coreutils \ - zlib-dev \ + zlib-dev \ libxml2-dev \ libxslt-dev \ freetype-dev \ @@ -15,6 +15,12 @@ RUN set -eux; \ libpng-dev \ libzip-dev \ postgresql-dev \ + php7-dev \ + # Equivalent of build essentials + alpine-sdk \ + imagemagick \ + imagemagick-libs \ + imagemagick-dev \ ; \ \ docker-php-ext-configure gd \ @@ -42,7 +48,10 @@ RUN set -eux; \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )"; \ + pecl install imagick; \ + \ apk add --virtual .drupal-phpexts-rundeps $runDeps; \ + docker-php-ext-enable --ini-name 20-imagick.ini imagick; \ apk del .build-deps # set recommended PHP.ini settings @@ -57,6 +66,7 @@ RUN { \ RUN { \ echo 'upload_max_filesize = 512M'; \ + echo 'zend.enable_gc = On;' \ echo 'post_max_size = 513M'; \ echo 'memory_limit = 512M'; \ echo 'max_execution_time = 300'; \ @@ -79,12 +89,117 @@ RUN apk -U add --no-cache \ mysql-client \ file \ # openjdk8-jre \ + curl \ + nano \ + poppler-utils \ + ghostscript \ + tesseract-ocr \ + tesseract-ocr-data-ita \ + tesseract-ocr-data-spa \ + && \ + rm -rf /var/lib/apt/lists/* && \ + rm /var/cache/apk/* + +# Installation of Composer +RUN cd /usr/src && curl -sS http://getcomposer.org/installer | php +RUN cd /usr/src && mv composer.phar /usr/bin/composer + +# 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 9.1.0 +RUN ln -s /usr/local/src/drush/drush /usr/bin/drush +RUN cd /usr/local/src/drush && composer update && composer install +RUN cd /usr/src && curl https://drupalconsole.com/installer -L -o drupal.phar && mv drupal.phar /usr/local/bin/drupal + +# from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements +FROM php:7.3-fpm-alpine + +# install the PHP extensions we need +# postgresql-dev is needed for https://bugs.alpinelinux.org/issues/3642 +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ + coreutils \ + zlib-dev \ + libxml2-dev \ + libxslt-dev \ + freetype-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libzip-dev \ + postgresql-dev \ + ; \ + \ + docker-php-ext-configure gd \ + --with-freetype-dir=/usr/include \ + --with-jpeg-dir=/usr/include \ + --with-png-dir=/usr/include \ + ; \ + \ + docker-php-ext-install -j "$(nproc)" \ + gd \ + zip \ + pdo_mysql \ + mysqli \ + xsl \ + opcache \ + exif \ + pgsql \ + pdo_pgsql \ + bcmath \ + ; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --virtual .drupal-phpexts-rundeps $runDeps; \ + apk del .build-deps + +# set recommended PHP.ini settings +# see https://secure.php.net/manual/en/opcache.installation.php +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=60'; \ + echo 'opcache.fast_shutdown=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini + +RUN { \ + echo 'upload_max_filesize = 512M'; \ + echo 'post_max_size = 513M'; \ + echo 'memory_limit = 512M'; \ + 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 + +RUN { \ + echo 'php_admin_value[error_log] = /proc/self/fd/2'; \ + echo 'php_admin_flag[log_errors] = on'; \ + echo 'catch_workers_output = yes'; \ + } >> /usr/local/etc/php-fpm.d/www.conf + +# Tools we want to keep +RUN apk -U add --no-cache \ + bash \ + git openssh \ + wget \ + imagemagick \ + mysql-client \ + file \ curl \ nano \ ghostscript \ + poppler-utils \ + python3 \ tesseract-ocr \ tesseract-ocr-data-ita \ tesseract-ocr-data-spa \ + exiftool \ && \ rm -rf /var/lib/apt/lists/* && \ rm /var/cache/apk/* @@ -100,22 +215,13 @@ RUN ln -s /usr/local/src/drush/drush /usr/bin/drush RUN cd /usr/local/src/drush && composer update && composer install RUN cd /usr/src && curl https://drupalconsole.com/installer -L -o drupal.phar && mv drupal.phar /usr/local/bin/drupal -# Install Droid from nationalarchives.uk -#RUN set -eux; \ -# curl -o 'https://github.com/digital-preservation/droid/zipball/master' /tmp/droid.zip && tar xzf /tmp/droid.zip /usr/local/droid && rm /tmp/droid.zip +# 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 \ + ./usr/src/fido-1.4.0/setup.py install \ + ln -s /usr/src/fido-1.4.0/fido/fido.py /usr/bin/fido.py # Change to bash since our folks like bash SHELL ["/bin/bash", "-c"] WORKDIR /var/www/html VOLUME ["/var/www/html"] -# https://www.drupal.org/node/3060/release -# ENV DRUPAL_VERSION 8.7.5 -# ENV DRUPAL_MD5 39cc326d9db1b4acce9b8716193189fd -# RUN set -eux; \ -# curl -fSL "https://ftp.drupal.org/files/projects/drupal-${DRUPAL_VERSION}.tar.gz" -o drupal.tar.gz; \ -# echo "${DRUPAL_MD5} *drupal.tar.gz" | md5sum -c -; \ -# tar -xz --strip-components=1 -f drupal.tar.gz; \ -# rm drupal.tar.gz; \ -# chown -R www-data:www-data sites modules themes - -# vim:set ft=dockerfile: From 2dcf449995be6af305b858060cbd633da13fdbed Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Fri, 3 Jan 2020 13:24:41 -0500 Subject: [PATCH 2/3] Wrong copy pasta from local Now it should go smooth --- esmero-php-fpm/Dockerfile | 109 ++------------------------------------ 1 file changed, 3 insertions(+), 106 deletions(-) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index b5ab0cc..b5c2b3a 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -80,109 +80,6 @@ RUN { \ echo 'catch_workers_output = yes'; \ } >> /usr/local/etc/php-fpm.d/www.conf -# Tools we want to keep -RUN apk -U add --no-cache \ - bash \ - git openssh \ - wget \ - imagemagick \ - mysql-client \ - file \ -# openjdk8-jre \ - curl \ - nano \ - poppler-utils \ - ghostscript \ - tesseract-ocr \ - tesseract-ocr-data-ita \ - tesseract-ocr-data-spa \ - && \ - rm -rf /var/lib/apt/lists/* && \ - rm /var/cache/apk/* - -# Installation of Composer -RUN cd /usr/src && curl -sS http://getcomposer.org/installer | php -RUN cd /usr/src && mv composer.phar /usr/bin/composer - -# 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 9.1.0 -RUN ln -s /usr/local/src/drush/drush /usr/bin/drush -RUN cd /usr/local/src/drush && composer update && composer install -RUN cd /usr/src && curl https://drupalconsole.com/installer -L -o drupal.phar && mv drupal.phar /usr/local/bin/drupal - -# from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements -FROM php:7.3-fpm-alpine - -# install the PHP extensions we need -# postgresql-dev is needed for https://bugs.alpinelinux.org/issues/3642 -RUN set -eux; \ - \ - apk add --no-cache --virtual .build-deps \ - coreutils \ - zlib-dev \ - libxml2-dev \ - libxslt-dev \ - freetype-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - libzip-dev \ - postgresql-dev \ - ; \ - \ - docker-php-ext-configure gd \ - --with-freetype-dir=/usr/include \ - --with-jpeg-dir=/usr/include \ - --with-png-dir=/usr/include \ - ; \ - \ - docker-php-ext-install -j "$(nproc)" \ - gd \ - zip \ - pdo_mysql \ - mysqli \ - xsl \ - opcache \ - exif \ - pgsql \ - pdo_pgsql \ - bcmath \ - ; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --virtual .drupal-phpexts-rundeps $runDeps; \ - apk del .build-deps - -# set recommended PHP.ini settings -# see https://secure.php.net/manual/en/opcache.installation.php -RUN { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=60'; \ - echo 'opcache.fast_shutdown=1'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini - -RUN { \ - echo 'upload_max_filesize = 512M'; \ - echo 'post_max_size = 513M'; \ - echo 'memory_limit = 512M'; \ - 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 - -RUN { \ - echo 'php_admin_value[error_log] = /proc/self/fd/2'; \ - echo 'php_admin_flag[log_errors] = on'; \ - echo 'catch_workers_output = yes'; \ - } >> /usr/local/etc/php-fpm.d/www.conf - # Tools we want to keep RUN apk -U add --no-cache \ bash \ @@ -217,9 +114,9 @@ RUN cd /usr/src && curl https://drupalconsole.com/installer -L -o drupal.phar && # 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 \ - ./usr/src/fido-1.4.0/setup.py install \ - ln -s /usr/src/fido-1.4.0/fido/fido.py /usr/bin/fido.py + && ln -s /usr/bin/python3 /usr/bin/python \ + && ./usr/src/fido-1.4.0/setup.py install \ + && ln -s /usr/src/fido-1.4.0/fido/fido.py /usr/bin/fido.py # Change to bash since our folks like bash SHELL ["/bin/bash", "-c"] From a700f3694e494dc9e4f48be1d44fca9a3b707c0c Mon Sep 17 00:00:00 2001 From: Diego Pino Navarro Date: Fri, 3 Jan 2020 13:48:40 -0500 Subject: [PATCH 3/3] Setup adds its own symlink, removing my quite not working one --- esmero-php-fpm/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/esmero-php-fpm/Dockerfile b/esmero-php-fpm/Dockerfile index b5c2b3a..f818412 100644 --- a/esmero-php-fpm/Dockerfile +++ b/esmero-php-fpm/Dockerfile @@ -114,9 +114,8 @@ RUN cd /usr/src && curl https://drupalconsole.com/installer -L -o drupal.phar && # 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 \ - && ./usr/src/fido-1.4.0/setup.py install \ - && ln -s /usr/src/fido-1.4.0/fido/fido.py /usr/bin/fido.py + && ln -s /usr/bin/python3 /usr/bin/python +RUN cd /usr/src/fido-1.4.0 && ./setup.py install # Change to bash since our folks like bash SHELL ["/bin/bash", "-c"]