diff --git a/Makefile b/Makefile index 5f97068ea..240577012 100644 --- a/Makefile +++ b/Makefile @@ -141,12 +141,15 @@ build/toolbox: build/commons build/mariadb images/toolbox/Dockerfile versioned-images := php-7.2-fpm \ php-7.3-fpm \ php-7.4-fpm \ + php-8.0-fpm \ php-7.2-cli \ php-7.3-cli \ php-7.4-cli \ + php-8.0-cli \ php-7.2-cli-drupal \ php-7.3-cli-drupal \ php-7.4-cli-drupal \ + php-8.0-cli-drupal \ python-2.7 \ python-3.7 \ python-3.8 \ @@ -209,13 +212,15 @@ base-images-with-versions += $(newly-versioned-images) s3-images += $(versioned-images) s3-images += $(newly-versioned-images) -build/php-7.2-fpm build/php-7.3-fpm build/php-7.4-fpm: build/commons +build/php-7.2-fpm build/php-7.3-fpm build/php-7.4-fpm build/php-8.0-fpm: build/commons build/php-7.2-cli: build/php-7.2-fpm build/php-7.3-cli: build/php-7.3-fpm build/php-7.4-cli: build/php-7.4-fpm +build/php-8.0-cli: build/php-8.0-fpm build/php-7.2-cli-drupal: build/php-7.2-cli build/php-7.3-cli-drupal: build/php-7.3-cli build/php-7.4-cli-drupal: build/php-7.4-cli +build/php-8.0-cli-drupal: build/php-8.0-cli build/python-2.7 build/python-3.7 build/python-3.8: build/commons build/python-2.7-ckan: build/python-2.7 build/python-2.7-ckandatapusher: build/python-2.7 diff --git a/images/php-cli-drupal/8.0.Dockerfile b/images/php-cli-drupal/8.0.Dockerfile new file mode 100644 index 000000000..2b79cc7eb --- /dev/null +++ b/images/php-cli-drupal/8.0.Dockerfile @@ -0,0 +1,26 @@ +ARG IMAGE_REPO +FROM ${IMAGE_REPO:-lagoon}/php-8.0-cli + +LABEL maintainer="amazee.io" +ENV LAGOON=cli-drupal + +# Defining Versions - https://github.com/hechoendrupal/drupal-console-launcher/releases +ENV DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ + DRUPAL_CONSOLE_LAUNCHER_SHA=fe83050489c66a0578eb59d6744420be6fd4c5d1 \ + DRUSH_VERSION=8.4.5 \ + DRUSH_LAUNCHER_VERSION=0.7.4 \ + DRUSH_LAUNCHER_FALLBACK=/opt/drush8/vendor/bin/drush + +RUN curl -L -o /usr/local/bin/drupal "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_LAUNCHER_VERSION}/drupal.phar" \ + && echo "${DRUPAL_CONSOLE_LAUNCHER_SHA} /usr/local/bin/drupal" | sha1sum -c - \ + && chmod +x /usr/local/bin/drupal \ + && mkdir -p /opt/drush8 \ + && php /usr/local/bin/composer init -n -d /opt/drush8 --require=drush/drush:${DRUSH_VERSION} \ + && php -d memory_limit=-1 /usr/local/bin/composer update -n -d /opt/drush8 \ + && wget -O /usr/local/bin/drush "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" \ + && chmod +x /usr/local/bin/drush \ + && mkdir -p /home/.drush + +COPY drushrc.php drush.yml /home/.drush/ + +RUN fix-permissions /home/.drush diff --git a/images/php-cli/8.0.Dockerfile b/images/php-cli/8.0.Dockerfile new file mode 100644 index 000000000..2ed1f2e22 --- /dev/null +++ b/images/php-cli/8.0.Dockerfile @@ -0,0 +1,69 @@ +ARG IMAGE_REPO +FROM ${IMAGE_REPO:-lagoon}/php-8.0-fpm + +LABEL maintainer="amazee.io" +ENV LAGOON=cli + +COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer + +RUN apk add --no-cache git \ + unzip \ + gzip \ + bash \ + tini \ + openssh-client \ + rsync \ + patch \ + procps \ + coreutils \ + mariadb-client \ + postgresql-client \ + openssh-sftp-server \ + findutils \ + nodejs-current \ + nodejs-npm \ + yarn \ + && ln -s /usr/lib/ssh/sftp-server /usr/local/bin/sftp-server \ + && rm -rf /var/cache/apk/* \ + && mkdir -p /home/.ssh \ + && fix-permissions /home/ + +# Adding Composer vendor bin path to $PATH. +ENV PATH="/home/.composer/vendor/bin:${PATH}" +# We not only use "export $PATH" as this could be overwritten again +# like it happens in /etc/profile of alpine Images. +COPY 90-composer-path.sh /lagoon/entrypoints/ + +# Remove warning about running as root in composer +ENV COMPOSER_ALLOW_SUPERUSER=1 + +# Making sure the path is not only added during entrypoint, but also when creating a new shell +RUN echo "source /lagoon/entrypoints/90-composer-path.sh" >> /home/.bashrc + +# Make sure shells are not running forever +COPY 80-shell-timeout.sh /lagoon/entrypoints/ +RUN echo "source /lagoon/entrypoints/80-shell-timeout.sh" >> /home/.bashrc + +# Make sure xdebug is automatically enabled also for cli scripts +COPY 61-php-xdebug-cli-env.sh /lagoon/entrypoints/ +RUN echo "source /lagoon/entrypoints/61-php-xdebug-cli-env.sh" >> /home/.bashrc + +# Copy mariadb-client configuration. +COPY 90-mariadb-envplate.sh /lagoon/entrypoints/ +COPY mariadb-client.cnf /etc/my.cnf.d/ +RUN fix-permissions /etc/my.cnf.d/ + +# helper functions +COPY 55-cli-helpers.sh /lagoon/entrypoints/ +RUN echo "source /lagoon/entrypoints/55-cli-helpers.sh" >> /home/.bashrc + +# SSH Key and Agent Setup +COPY 05-ssh-key.sh /lagoon/entrypoints/ +COPY 10-ssh-agent.sh /lagoon/entrypoints/ +COPY ssh_config /etc/ssh/ssh_config +COPY id_ed25519_lagoon_cli.key /home/.ssh/lagoon_cli.key +RUN chmod 400 /home/.ssh/lagoon_cli.key +ENV SSH_AUTH_SOCK=/tmp/ssh-agent + +ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"] +CMD ["/bin/docker-sleep"] diff --git a/images/php-fpm/8.0.Dockerfile b/images/php-fpm/8.0.Dockerfile new file mode 100644 index 000000000..8538aecbb --- /dev/null +++ b/images/php-fpm/8.0.Dockerfile @@ -0,0 +1,144 @@ +ARG IMAGE_REPO +FROM ${IMAGE_REPO:-lagoon}/commons as commons + +FROM composer:latest as healthcheckbuilder + +RUN composer create-project --no-dev amazeeio/healthz-php /healthz-php v0.0.6 + +FROM php:8.0.0-fpm-alpine3.12 + +LABEL maintainer="amazee.io" +ENV LAGOON=php + +ARG LAGOON_VERSION +ENV LAGOON_VERSION=$LAGOON_VERSION + +# Copy commons files +COPY --from=commons /lagoon /lagoon +COPY --from=commons /bin/fix-permissions /bin/ep /bin/docker-sleep /bin/ +COPY --from=commons /sbin/tini /sbin/ +COPY --from=commons /home /home + +# Copy healthcheck files + +COPY --from=healthcheckbuilder /healthz-php /healthz-php + +RUN chmod g+w /etc/passwd \ + && mkdir -p /home + +ENV TMPDIR=/tmp \ + TMP=/tmp \ + HOME=/home \ + # When Bash is invoked via `sh` it behaves like the old Bourne Shell and sources a file that is given in `ENV` + ENV=/home/.bashrc \ + # When Bash is invoked as non-interactive (like `bash -c command`) it sources a file that is given in `BASH_ENV` + BASH_ENV=/home/.bashrc + +COPY check_fcgi /usr/sbin/ +COPY entrypoints/70-php-config.sh entrypoints/60-php-xdebug.sh entrypoints/50-ssmtp.sh entrypoints/71-php-newrelic.sh entrypoints/80-php-blackfire.sh /lagoon/entrypoints/ + +COPY php.ini /usr/local/etc/php/ +COPY 00-lagoon-php.ini.tpl /usr/local/etc/php/conf.d/ +COPY php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf +COPY ssmtp.conf /etc/ssmtp/ssmtp.conf +COPY blackfire.ini /usr/local/etc/php/conf.d/blackfire.disable + +# New Relic PHP Agent. +# @see https://docs.newrelic.com/docs/release-notes/agent-release-notes/php-release-notes/ +# @see https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements +ENV NEWRELIC_VERSION=9.13.0.270 + +RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.12/main/ 'curl>7.68' 'libcurl>7.68' + +RUN apk add --no-cache fcgi \ + ssmtp \ + libzip libzip-dev \ + # for gd + libpng-dev \ + libjpeg-turbo-dev \ + # for gettext + gettext-dev \ + # for mcrypt + libmcrypt-dev \ + # for soap + libxml2-dev \ + # for xsl + libxslt-dev \ + libgcrypt-dev \ + # for webp + libwebp-dev \ + postgresql-dev \ + # for yaml + yaml-dev \ + # for imagemagick + imagemagick \ + imagemagick-libs \ + imagemagick-dev \ + && apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \ + && docker-php-ext-configure gd --with-webp --with-jpeg \ + && docker-php-ext-install -j4 bcmath gd gettext pdo_mysql mysqli pdo_pgsql pgsql shmop soap sockets opcache xsl zip \ + # ext-imagick - waiting on stable release to use PECL to install + && docker-php-source extract \ + && mkdir -p /usr/src/php/ext/imagick \ + && curl -fsSL https://api.github.com/repos/imagick/imagick/tarball | tar xvz -C /usr/src/php/ext/imagick --strip 1 \ + && docker-php-ext-install imagick \ + && docker-php-source delete \ +# Legacy PECL installs + && pecl channel-update pecl.php.net \ + && yes '' | pecl install -f apcu-5.1.19 \ + # && yes '' | pecl install -f imagick \ + && yes '' | pecl install -f redis-5.3.2 \ + && yes '' | pecl install -f xdebug-3.0.0 \ + && yes '' | pecl install -f yaml-2.2.0 \ + && docker-php-ext-enable apcu imagick redis xdebug yaml +# RUN sed -i '1s/^/;Intentionally disabled. Enable via setting env variable XDEBUG_ENABLE to true\n;/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ +RUN rm -rf /var/cache/apk/* /tmp/pear/ \ + && apk del .phpize-deps \ + # && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/yaml.ini \ + # NewRelic not PHP8 compatible yet + # && mkdir -p /tmp/newrelic && cd /tmp/newrelic \ + # && wget https://download.newrelic.com/php_agent/archive/${NEWRELIC_VERSION}/newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz \ + # && gzip -dc newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz | tar --strip-components=1 -xf - \ + # && NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 ./newrelic-install install \ + # && sed -i -e "s/newrelic.appname = .*/newrelic.appname = \"\${LAGOON_PROJECT:-noproject}-\${LAGOON_GIT_SAFE_BRANCH:-nobranch}\"/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/;newrelic.enabled = .*/newrelic.enabled = \${NEWRELIC_ENABLED:-false}/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/;newrelic.browser_monitoring.auto_instrument = .*/newrelic.browser_monitoring.auto_instrument = \${NEWRELIC_BROWSER_MONITORING_ENABLED:-true}/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/newrelic.license = .*/newrelic.license = \"\${NEWRELIC_LICENSE:-}\"/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/;newrelic.loglevel = .*/newrelic.loglevel = \"\${NEWRELIC_LOG_LEVEL:-warning}\"/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/;newrelic.daemon.loglevel = .*/newrelic.daemon.loglevel = \"\${NEWRELIC_DAEMON_LOG_LEVEL:-warning}\"/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/newrelic.logfile = .*/newrelic.logfile = \"\/dev\/stdout\"/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && sed -i -e "s/newrelic.daemon.logfile = .*/newrelic.daemon.logfile = \"\/dev\/stdout\"/" /usr/local/etc/php/conf.d/newrelic.ini \ + # && mv /usr/local/etc/php/conf.d/newrelic.ini /usr/local/etc/php/conf.d/newrelic.disable \ + # && cd / && rm -rf /tmp/newrelic \ + && mkdir -p /app \ + && fix-permissions /usr/local/etc/ \ + && fix-permissions /app \ + && fix-permissions /etc/ssmtp/ssmtp.conf + +# Add blackfire probe. +RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && mkdir -p /blackfire \ + && curl -A "Docker" -o /blackfire/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/amd64/$version \ + && tar zxpf /blackfire/blackfire-probe.tar.gz -C /blackfire \ + && mv /blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && rm -rf /blackfire + +EXPOSE 9000 + +ENV AMAZEEIO_DB_HOST=mariadb \ + AMAZEEIO_DB_PORT=3306 \ + AMAZEEIO_DB_USERNAME=drupal \ + AMAZEEIO_DB_PASSWORD=drupal \ + AMAZEEIO_SITENAME=drupal \ + AMAZEEIO_SITE_NAME=drupal \ + AMAZEEIO_SITE_ENVIRONMENT=development \ + AMAZEEIO_HASH_SALT=0000000000000000000000000 \ + AMAZEEIO_TMP_PATH=/tmp \ + AMAZEEIO_LOCATION=docker + +ENV LAGOON_ENVIRONMENT_TYPE=development + +WORKDIR /app + +ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"] +CMD ["/usr/local/sbin/php-fpm", "-F", "-R"]