From 8675ba0ef34aa85f0618fbe943f31a7b2611f95e Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 16:10:14 +0100 Subject: [PATCH 01/23] Dropped PHP 8.0 PHP 8.0 is EOL as 2023.11.26 --- .github/workflows/default.yaml | 17 - 8.0/.dockerignore | 4 - 8.0/Dockerfile | 532 ------------------ 8.0/Makefile | 76 --- 8.0/config/.ssh/config | 5 - 8.0/config/.ssh/id_rsa.tmpl | 1 - 8.0/config/.terminus/config.yml | 2 - 8.0/config/code-server/User/settings.json | 37 -- 8.0/config/code-server/config.yaml.tmpl | 9 - 8.0/config/php/opcache.ini | 3 - 8.0/config/php/xdebug.ini | 12 - 8.0/config/php/xhprof.ini | 2 - 8.0/config/php/zz-php-fpm.conf | 19 - 8.0/config/php/zz-php.ini | 19 - .../supervisord-code-server.conf.tmpl | 6 - 8.0/config/supervisor/supervisord-crond.conf | 5 - .../supervisor/supervisord-php-fpm.conf | 4 - 8.0/config/supervisor/supervisord-sshd.conf | 4 - 8.0/config/supervisor/supervisord.conf | 6 - 8.0/healthcheck.sh | 16 - 8.0/ping-web.sh | 11 - 8.0/startup.sh | 238 -------- 8.0/tests/essential-binaries.sh | 82 --- 8.0/tests/php-modules.sh | 151 ----- 24 files changed, 1261 deletions(-) delete mode 100644 8.0/.dockerignore delete mode 100644 8.0/Dockerfile delete mode 100644 8.0/Makefile delete mode 100644 8.0/config/.ssh/config delete mode 100644 8.0/config/.ssh/id_rsa.tmpl delete mode 100644 8.0/config/.terminus/config.yml delete mode 100644 8.0/config/code-server/User/settings.json delete mode 100644 8.0/config/code-server/config.yaml.tmpl delete mode 100644 8.0/config/php/opcache.ini delete mode 100644 8.0/config/php/xdebug.ini delete mode 100644 8.0/config/php/xhprof.ini delete mode 100644 8.0/config/php/zz-php-fpm.conf delete mode 100644 8.0/config/php/zz-php.ini delete mode 100644 8.0/config/supervisor/supervisord-code-server.conf.tmpl delete mode 100644 8.0/config/supervisor/supervisord-crond.conf delete mode 100644 8.0/config/supervisor/supervisord-php-fpm.conf delete mode 100644 8.0/config/supervisor/supervisord-sshd.conf delete mode 100644 8.0/config/supervisor/supervisord.conf delete mode 100755 8.0/healthcheck.sh delete mode 100755 8.0/ping-web.sh delete mode 100755 8.0/startup.sh delete mode 100755 8.0/tests/essential-binaries.sh delete mode 100755 8.0/tests/php-modules.sh diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index 2f19eeea..1335d19a 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -31,10 +31,6 @@ jobs: fail-fast: false # Don't cancel other jobs if one fails matrix: include: - - - platform: linux/amd64 - arch: amd64 - version: '8.0' - platform: linux/amd64 arch: amd64 @@ -43,10 +39,6 @@ jobs: platform: linux/amd64 arch: amd64 version: '8.2' - - - platform: linux/arm64 - arch: arm64 - version: '8.0' - platform: linux/arm64 arch: arm64 @@ -120,10 +112,6 @@ jobs: fail-fast: false # Don't cancel other jobs if one fails matrix: include: - - - platform: linux/amd64 - arch: amd64 - version: '8.0' - platform: linux/amd64 arch: amd64 @@ -132,10 +120,6 @@ jobs: platform: linux/amd64 arch: amd64 version: '8.2' - - - platform: linux/arm64 - arch: arm64 - version: '8.0' - platform: linux/arm64 arch: arm64 @@ -217,7 +201,6 @@ jobs: strategy: matrix: version: - - '8.0' - '8.1' - '8.2' diff --git a/8.0/.dockerignore b/8.0/.dockerignore deleted file mode 100644 index 0123c988..00000000 --- a/8.0/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -tests -.dockerignore -Dockerfile -Makefile diff --git a/8.0/Dockerfile b/8.0/Dockerfile deleted file mode 100644 index e70717a7..00000000 --- a/8.0/Dockerfile +++ /dev/null @@ -1,532 +0,0 @@ -FROM php:8.0.30-fpm-bullseye as cli - -ARG TARGETARCH -ARG DEBIAN_FRONTEND=noninteractive -ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 - -# Prevent services autoload (http://jpetazzo.github.io/2013/10/06/policy-rc-d-do-not-start-services-automatically/) -RUN set -xe; \ - echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d - -# Install basic packages -RUN set -xe; \ - apt-get update >/dev/null; \ - apt-get -y --no-install-recommends install >/dev/null \ - apt-transport-https \ - # ca-certificates and curl come from upstream - #ca-certificates \ - #curl \ - gnupg \ - locales \ - wget \ - ;\ - # Cleanup - apt-get clean; rm -rf /var/lib/apt/lists/* - -# Set en_US.UTF-8 as the default locale -RUN set -xe; \ - localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 -ENV LC_ALL en_US.utf8 - -# Enable additional repos -RUN set -xe; \ - sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # blackfire.io repo - curl -fsSL https://packages.blackfire.io/gpg.key | apt-key add -; \ - echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ - # git-lfs repo - curl -fsSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian bullseye main' | tee /etc/apt/sources.list.d/github_git-lfs.list; - -# Additional packages -RUN set -xe; \ - # Create man direcotries, otherwise some packages may not install (e.g. postgresql-client) - # This should be a temporary workaround until fixed upstream: https://github.com/debuerreotype/debuerreotype/issues/10 - mkdir -p /usr/share/man/man1 /usr/share/man/man7; \ - apt-get update >/dev/null; \ - apt-get -y --no-install-recommends install >/dev/null \ - cron \ - dnsutils \ - git \ - git-lfs \ - ghostscript \ - # html2text binary - used for self-testing (php-fpm) - html2text \ - imagemagick \ - iputils-ping \ - less \ - # cgi-fcgi binary - used for self-testing (php-fpm) - libfcgi-bin \ - mc \ - msmtp \ - # Debian ships with MariaDB instead of MySQL - mariadb-client \ - nano \ - openssh-client \ - openssh-server \ - postgresql-client \ - procps \ - pv \ - rsync \ - sudo \ - supervisor \ - unzip \ - webp \ - zip \ - ;\ - # Cleanup - apt-get clean; rm -rf /var/lib/apt/lists/* - -RUN set -xe; \ - # Create a regular user/group "docker" (uid = 1000, gid = 1000 ) - useradd -m -s /bin/bash -u 1000 -U -p docker docker; \ - # Give the docker user sudo access - usermod -a -G sudo docker; \ - echo 'docker ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers - -# gosu v1.14+ discorages using it as a non-root user (https://github.com/tianon/gosu/issues/11), which we rely on here. -# See https://github.com/tianon/gosu/pull/89/commits/8afd3dec5fb4fe0356e4fb5d358fe235f7311181 -# We'll stick with v1.13 for the time being. -# TODO: Replace gosu with sudo/su in startup.sh -ENV \ - GOSU_VERSION=1.13 \ - GOMPLATE_VERSION=3.11.3 -RUN set -xe; \ - # Install gosu and give access to the docker user primary group to use it. - # gosu is used instead of sudo to start the main container process (pid 1) in a docker friendly way. - # https://github.com/tianon/gosu - curl -fsSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGETARCH} -o /usr/local/bin/gosu; \ - chown root:$(id -gn docker) /usr/local/bin/gosu; \ - chmod +sx /usr/local/bin/gosu; \ - # gomplate (to process configuration templates in startup.sh) - curl -fsSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-${TARGETARCH} -o /usr/local/bin/gomplate; \ - chmod +x /usr/local/bin/gomplate - -# Configure sshd (for use PHPStorm's remote interpreters and tools integrations) -# http://docs.docker.com/examples/running_ssh_service/ -RUN set -xe; \ - mkdir /var/run/sshd; \ - echo 'docker:docker' | chpasswd; \ - sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config; \ - # SSH login fix. Otherwise user is kicked off after login - sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd; \ - echo "export VISIBLE=now" >> /etc/profile -ENV NOTVISIBLE "in users profile" - -# PHP -RUN set -xe; \ - # Note: essential build tools (g++, gcc, make, etc) are included upstream as persistent packages. - buildDeps=" \ - libc-client2007e-dev \ - libfreetype6-dev \ - libgpgme11-dev \ - libicu-dev \ - libjpeg62-turbo-dev \ - libkrb5-dev \ - libldap2-dev \ - libmagickcore-dev \ - libmagickwand-dev \ - libmemcached-dev \ - libmhash-dev \ - libpng-dev \ - libpq-dev \ - libwebp-dev \ - libssh2-1-dev \ - libxpm-dev \ - libxslt1-dev \ - libzip-dev \ - unixodbc-dev \ - "; \ - apt-get update >/dev/null; \ - apt-get -y --no-install-recommends install >/dev/null \ - $buildDeps \ - blackfire-php \ - libc-client2007e \ - libfreetype6 \ - libgpgme11 \ - libicu67 \ - libjpeg62-turbo \ - libldap-2.4-2 \ - libmagickcore-6.q16-*-extra \ - libmagickwand-6.q16-6 \ - libmemcached11 \ - libmemcachedutil2 \ - libmhash2 \ - libpng16-16 \ - libpq5 \ - libssh2-1 \ - libxpm4 \ - libxslt1.1 \ - libzip4 \ - ;\ - docker-php-ext-configure >/dev/null gd \ - --with-freetype \ - --with-jpeg \ - --with-webp \ - --with-xpm; \ - PHP_OPENSSL=yes docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ - # Using $(uname -m) (returns x86_64 / aarch64) vs ${TARGETARCH} (returns amd64 / arm64) - docker-php-ext-configure >/dev/null ldap --with-libdir=lib/$(uname -m)-linux-gnu/; \ - docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ - docker-php-ext-configure >/dev/null zip; \ - \ - docker-php-ext-install >/dev/null -j$(nproc) \ - bcmath \ - bz2 \ - calendar\ - exif \ - gd \ - gettext \ - imap \ - intl \ - ldap \ - mysqli \ - opcache \ - pcntl \ - pdo_mysql \ - pdo_pgsql \ - pgsql \ - soap \ - sockets \ - xsl \ - zip \ - sysvsem \ - ;\ - pecl update-channels; \ - pecl install >/dev/null /dev/null; \ - apt-get clean; rm -rf /var/lib/apt/lists/* - -# MSSQL PHP client -RUN set -xe; \ - # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv - curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ - # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). - #curl -fsSL https://packages.microsoft.com/config/debian/11/prod.list -o /etc/apt/sources.list.d/mssql.list; \ - curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ - \ - buildDeps=" \ - unixodbc-dev \ - "; \ - apt-get update >/dev/null; \ - # Necessary for msodbcsql18 (MSSQL) - ACCEPT_EULA=Y \ - apt-get -y --no-install-recommends install >/dev/null \ - $buildDeps \ - msodbcsql18 \ - ;\ - pecl update-channels; \ - pecl install >/dev/null /dev/null; \ - apt-get clean; rm -rf /var/lib/apt/lists/* - -# PHP tools (installed globally) -ENV \ - COMPOSER_DEFAULT_VERSION=2 \ - COMPOSER_VERSION=1.10.27 \ - COMPOSER2_VERSION=2.6.5 \ - DRUSH_VERSION=8.4.12 \ - DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ - WPCLI_VERSION=2.9.0 \ - BLACKFIRE_VERSION=2.10.0 \ - PLATFORMSH_CLI_VERSION=4.10.4 \ - ACQUIA_CLI_VERSION=2.18.0 \ - TERMINUS_VERSION=3.2.2 \ - JQ_VERSION=1.7 \ - YQ_VERSION=4.35.2 -RUN set -xe; \ - # Composer 1.x - curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer1; \ - # Composer 2.x - curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER2_VERSION}/composer.phar" -o /usr/local/bin/composer2; \ - # Drush 8 (global fallback) - curl -fsSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush8; \ - # Drupal Console Launcher - curl -fsSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_LAUNCHER_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ - # Wordpress CLI - curl -fsSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Blackfire CLI - # Find out the most recent version number: - # curl -X GET -Is https://blackfire.io/api/v1/releases/cli/linux/amd64 | grep location | awk '{print $2}' - curl -fsSL "https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${TARGETARCH}" -o /usr/local/bin/blackfire; \ - # Platform.sh CLI - curl -fsSL "https://github.com/platformsh/legacy-cli/releases/download/v${PLATFORMSH_CLI_VERSION}/platform.phar" -o /usr/local/bin/platform; \ - # Acquia CLI - curl -fsSL "https://github.com/acquia/cli/releases/download/${ACQUIA_CLI_VERSION}/acli.phar" -o /usr/local/bin/acli; \ - # Pantheon Terminus - curl -fsSL "https://github.com/pantheon-systems/terminus/releases/download/${TERMINUS_VERSION}/terminus.phar" -o /usr/local/bin/terminus; \ - # jq - curl -fsSL "https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux-${TARGETARCH}" -o /usr/local/bin/jq; \ - # yq - curl -fsSL "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${TARGETARCH}" -o /usr/local/bin/yq; \ - # Set Default Composer Version - ln -s /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} /usr/local/bin/composer; \ - # Make all downloaded binaries executable in one shot - (cd /usr/local/bin && chmod +x composer1 composer2 drush8 drupal wp blackfire platform acli terminus jq yq); - -# Install Python 3 + pip from Debian repos -RUN set -xe; \ - apt-get update >/dev/null; \ - apt-get -y --no-install-recommends install >/dev/null \ - python3 \ - python3-pip \ - ;\ - # Cleanup - apt-get clean; rm -rf /var/lib/apt/lists/* - -# Install Ruby from Debian repos -RUN set -xe; \ - apt-get update >/dev/null; \ - apt-get -y --no-install-recommends install >/dev/null \ - ruby-full \ - ;\ - # Cleanup - apt-get clean; rm -rf /var/lib/apt/lists/* - -# All further RUN commands will run as the "docker" user -USER docker -SHELL ["/bin/bash", "-c"] - -# Don't use -x here, as the output may be excessive -RUN set -e; \ - \ - # Composer based dependencies - # Add composer bin project level and global directories to PATH - # Project level comes first and thus takes precedence over the global one - echo -e "\n"'export PATH="$PATH:${PROJECT_ROOT:-/var/www}/vendor/bin"' >> $HOME/.profile; \ - echo -e "\n"'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ - # Reload updated PATH from profile to make composer/etc. visible below - . $HOME/.profile; \ - # Drupal Coder & WP Coding Standards w/ a matching version of PHP_CodeSniffer - # Set allow-plugins. See https://getcomposer.org/allow-plugins - composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true; \ - composer global require drupal/coder wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp; \ - # Don't fix the indentation or installed_paths will not be set correctly - phpcs --config-set installed_paths \ -$HOME/.composer/vendor/drupal/coder/coder_sniffer/,\ -$HOME/.composer/vendor/wp-coding-standards/wpcs/,\ -$HOME/.composer/vendor/phpcompatibility/php-compatibility/PHPCompatibility/,\ -$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP,\ -$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat; \ - # Cleanup - composer clear-cache - -# Node.js (installed as user) -ENV \ - NVM_VERSION=0.39.5 \ - NODE_VERSION=18.17.0 \ - YARN_VERSION=1.22.19 -# Don't use -x here, as the output may be excessive -RUN set -e; \ - # NVM and a defaut Node.js version - export PROFILE="$HOME/.profile"; \ - curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash >/dev/null; \ - # Reload profile to load nvm (needed by Yarn installation below) - . $HOME/.profile; \ - # Yarn - export YARN_PROFILE="$HOME/.profile"; \ - curl -fsSL https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} >/dev/null - -## Ruby (installed as user) via rvm -## Note: Disabled. rvm + its build dependecies bloat the image (~80MB) -## Debian 11 ships with Ruby 2.7, so we'll stick with that by default. -## It is still possible for the end user to switch to a different Ruby version via rvm. -#ENV \ -# RVM_VERSION_INSTALL=1.29.10 \ -# RUBY_VERSION_INSTALL=2.7.2 -## Don't use -x here, as the output may be excessive -#RUN set -e; \ -# # Export ruby gem bin path -# echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \ -# . $HOME/.profile; \ -# # Public GPG servers are not realiable, so downloading keys from rvm.io instead. -# #gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB -# # Import and trust rvm keys -# # mpapis@gmail.com -# curl -sSL https://rvm.io/mpapis.asc | gpg --batch --import -; \ -# echo 409B6B1796C275462A1703113804BB82D39DC0E3:6: | gpg --batch --import-ownertrust; \ -# # piotr.kuczynski@gmail.com -# curl -sSL https://rvm.io/pkuczynski.asc | gpg --batch --import -; \ -# echo 7D2BAF1CF37B13E2069D6956105BD0E739499BDB:6: | gpg --batch --import-ownertrust; \ -# \ -# echo 'rvm_autoupdate_flag=0' >> $HOME/.rvmrc; \ -# echo 'rvm_silence_path_mismatch_check_flag=1' >> $HOME/.rvmrc; \ -# curl -fsSL https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION_INSTALL}/binscripts/rvm-installer | bash -s -- --ignore-dotfiles --version ${RVM_VERSION_INSTALL}; \ -# { \ -# echo ''; \ -# echo 'export PATH="$PATH:$HOME/.rvm/bin"'; \ -# echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'; \ -# } >> $HOME/.profile; \ -# # Reload $HOME/.profile to apply settings for the current shell -# . $HOME/.profile; \ -# \ -# # rvm.io does not currently have ruby binaries for Debian 9, so Ruby is compiled from source, which requires a bunch -# # of extra dependencies installed (rvm installs these automatically), which bloat this image: -# # rvm/ruby required packages: gawk, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev -# rvm install ruby-${RUBY_VERSION_INSTALL}; \ -# rvm use ruby-${RUBY_VERSION_INSTALL} --default; \ -# \ -# gem install --user-install bundler; \ -# # Have bundler install gems locally (./.bundle) by default -# echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile; \ -# \ -# rvm cleanup all; \ -# rvm gemset globalcache enable - -## Ruby bundler -## Don't use -x here, as the output may be excessive -RUN set -e; \ - # Export ruby gem bin path - echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \ - . $HOME/.profile; \ - gem install --user-install bundler; \ - # Have bundler install gems in the current directory (./.bundle) by default - echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile - -# Python (installed as user) via pyenv -# Note: Disabled. pyenv + its build dependecies bloat the image (~300MB). -# Debian 10 ships with Python 3.7, so we'll stick with that by default. -# It is still possible for the end user to switch to a different python version via pyenv. -#ENV \ -# PYENV_VERSION_INSTALL=1.2.21 \ -# PYTHON_VERSION_INSTALL=3.8.3 -#RUN set -xe; \ -# # pyenv requires a bunch of build dependencies installed, which would bloat this image -# # See https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites -# sudo apt-get update >/dev/null; \ -# sudo apt-get -y --no-install-recommends install >/dev/null \ -# build-essential libssl-dev zlib1g-dev libbz2-dev \ -# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ -# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \ -# ;\ -# # Cleanup -# sudo apt-get clean; sudo rm -rf /var/lib/apt/lists/*; \ -# \ -# git clone --depth 1 -b v${PYENV_VERSION_INSTALL} https://github.com/pyenv/pyenv.git $HOME/.pyenv; \ -# rm -rf $HOME/.pyenv/.git; \ -# { \ -# echo ''; \ -# echo 'export PYENV_ROOT="$HOME/.pyenv"'; \ -# echo 'export PATH="$PYENV_ROOT/bin:$PATH"'; \ -# echo 'eval "$(pyenv init -)"'; \ -# } >> $HOME/.profile; \ -# # Reload $HOME/.profile to apply settings for the current shell -# . $HOME/.profile; \ -# pyenv install ${PYTHON_VERSION_INSTALL}; \ -# pyenv global ${PYTHON_VERSION_INSTALL} - -# Notify web container about started fin exec -RUN echo '(/opt/ping-web.sh &)' >> $HOME/.profile - -USER root -SHELL ["/bin/sh", "-c"] - -# Copy configs and scripts -COPY --chown=docker:docker config/.terminus /home/docker/.terminus -COPY --chown=docker:docker config/.ssh /home/docker/.ssh -COPY config/supervisor /etc/supervisor/conf.d -COPY startup.sh /opt/startup.sh -COPY healthcheck.sh /opt/healthcheck.sh -COPY ping-web.sh /opt/ping-web.sh -# PHP default settings, global overrides and fpm overrides -RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" -COPY config/php/zz-php.ini /usr/local/etc/php/conf.d/zz-php.ini -COPY config/php/xdebug.ini /opt/docker-php-ext-xdebug.ini -COPY config/php/xhprof.ini /opt/docker-php-ext-xhprof.ini -COPY config/php/opcache.ini /opt/docker-php-ext-opcache.ini -COPY config/php/zz-php-fpm.conf /usr/local/etc/php-fpm.d/zz-php-fpm.conf - -ENV \ - # ssh-agent proxy socket (requires docksal/ssh-agent) - SSH_AUTH_SOCK=/.ssh-agent/proxy-socket \ - # Set TERM so text editors/etc. can be used - TERM=xterm \ - # Allow PROJECT_ROOT to be universally used in fin custom commands (inside and outside cli) - PROJECT_ROOT=/var/www \ - # Default values for HOST_UID and HOST_GUI to match the default Ubuntu user. These are used in startup.sh - HOST_UID=1000 \ - HOST_GID=1000 \ - # Delay in seconds between pings web from cli, while running fin exec. 0 - disabled - WEB_KEEPALIVE=0 \ - # xdebug disabled by default - XDEBUG_ENABLED=0 \ - XHPROF_ENABLED=0 \ - XHPROF_OUTPUT_DIR=/tmp/xhprof - -# TODO: [v3] remove and set these via docker-compose -EXPOSE 9000 -EXPOSE 22 -EXPOSE 3000 - -WORKDIR /var/www - -# Starter script -ENTRYPOINT ["/opt/startup.sh"] - -# By default, launch supervisord to keep the container running. -CMD ["supervisord"] - -# Health check script -HEALTHCHECK --interval=5s --timeout=1s --retries=12 CMD ["/opt/healthcheck.sh"] - - -# Visual Studio Code Server flavor -FROM cli as code-server - -# Run as docker, so we don't have to fix permissions -USER docker - -ARG HOME=/home/docker - -ENV \ - CODE_SERVER_VERSION=4.10.1 \ - VSCODE_GITLENS_VERSION=13.2.2 \ - VSCODE_XDEBUG_VERSION=1.32.0 \ - VSCODE_HOME="${HOME}/code-server" - -# Install code-server -RUN set -xe; \ - curl -fsSL "https://github.com/cdr/code-server/releases/download/v${CODE_SERVER_VERSION}/code-server_${CODE_SERVER_VERSION}_${TARGETARCH}.deb" -o /tmp/code-server_${TARGETARCH}.deb; \ - sudo dpkg -i /tmp/code-server_${TARGETARCH}.deb; \ - rm -rf /tmp/*.* - -# Settings -COPY --chown=docker:docker config/code-server ${VSCODE_HOME} - -# Install extensions -# Note: Have to use --user-data-dir with --install-extension instead of --config -RUN set -xe; \ - code-server --user-data-dir=${VSCODE_HOME} --install-extension eamodio.gitlens@${VSCODE_GITLENS_VERSION}; \ - code-server --user-data-dir=${VSCODE_HOME} --install-extension felixfbecker.php-debug@${VSCODE_XDEBUG_VERSION} - -# Switch back to root (IMPORTANT!) -USER root diff --git a/8.0/Makefile b/8.0/Makefile deleted file mode 100644 index 36282f9f..00000000 --- a/8.0/Makefile +++ /dev/null @@ -1,76 +0,0 @@ --include ../tests/env_make --include env_make - -IMAGE ?= docksal/cli -VERSION_PREFIX ?= php -VERSION ?= 8.0 -BUILD_IMAGE_TAG ?= $(IMAGE):$(VERSION_PREFIX)$(VERSION)-build -NAME = docksal-cli-$(VERSION)-$(GIT_SHA7) -CWD = $(shell pwd) - -# Improve write performance for /home/docker by turning it into a volume -VOLUMES = -v /home/docker - -.EXPORT_ALL_VARIABLES: - -.PHONY: build exec test push shell run start stop logs clean release - -default: build - -build: - docker build -t $(BUILD_IMAGE_TAG) . - -# See https://docs.docker.com/buildx/working-with-buildx/ -# See https://github.com/docker/buildx -buildx: - docker buildx build --tag $(BUILD_IMAGE_TAG) . -buildx-with-cache: - docker buildx build --cache-from=type=registry,ref=$(BUILD_IMAGE_TAG) --cache-to=type=inline --tag=$(BUILD_IMAGE_TAG) . - -test: - NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats - -push: - docker push $(BUILD_IMAGE_TAG) - -run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) - -# Copy files into container instead of mounting from the host at runtime. -# This allows running tests on a remote docker instance. -start: clean - docker create --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) - docker cp ../tests/. $(NAME):/var/www/ - docker start $(NAME) - -# Only copy docroot (not config overrides) -start-bare: clean - docker create --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) - docker cp ../tests/docroot/. $(NAME):/var/www/docroot/ - docker start $(NAME) - -# Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) -exec: - @docker exec -u docker $(NAME) bash -lc "$(CMD)" - -# Interactive docker exec -exec-it: - @docker exec -u docker -it $(NAME) bash -ilc "$(CMD)" - -shell: - @docker exec -u docker -it $(NAME) bash -il - -stop: - docker stop $(NAME) - -logs: - docker logs $(NAME) - -logs-follow: - docker logs -f $(NAME) - -clean: - docker rm -vf $(NAME) >/dev/null 2>&1 || true - -tags: - @../.github/scripts/docker-tags.sh diff --git a/8.0/config/.ssh/config b/8.0/config/.ssh/config deleted file mode 100644 index 74320faa..00000000 --- a/8.0/config/.ssh/config +++ /dev/null @@ -1,5 +0,0 @@ -# Disable remote host key checking and warnings -Host * - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - LogLevel ERROR diff --git a/8.0/config/.ssh/id_rsa.tmpl b/8.0/config/.ssh/id_rsa.tmpl deleted file mode 100644 index 8c6c22f1..00000000 --- a/8.0/config/.ssh/id_rsa.tmpl +++ /dev/null @@ -1 +0,0 @@ -{{ getenv "SECRET_SSH_PRIVATE_KEY" | base64.Decode }} \ No newline at end of file diff --git a/8.0/config/.terminus/config.yml b/8.0/config/.terminus/config.yml deleted file mode 100644 index c7e89515..00000000 --- a/8.0/config/.terminus/config.yml +++ /dev/null @@ -1,2 +0,0 @@ -hide_update_message: true -hide_git_mode_warning: true \ No newline at end of file diff --git a/8.0/config/code-server/User/settings.json b/8.0/config/code-server/User/settings.json deleted file mode 100644 index 1007d613..00000000 --- a/8.0/config/code-server/User/settings.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - // XDebug Launch Configuration settings - "launch": { - "version": "0.2.0", - "configurations": [ - // Listener mode (recommended for most cases) - // Can be used to debug both: web and cli PHP sessions. - { - "name": "XDebug (listener)", - "type": "php", - "request": "launch", - "port": 9000 - }, - // Current script mode - // Note: IDE launches the script inside of the ide container and not the cli container. - { - "name": "XDebug (currently open script)", - "type": "php", - "request": "launch", - "program": "${file}", - "cwd": "${fileDirname}", - "port": 9000 - } - ] - }, - // File associations - "files.associations": { - "*.inc": "php", - "*.module": "php", - "*.install": "php", - "*.theme": "php", - "*.tpl.php": "php", - "*.test": "php", - "*.php": "php" - }, - "workbench.colorTheme": "Default Dark+" -} diff --git a/8.0/config/code-server/config.yaml.tmpl b/8.0/config/code-server/config.yaml.tmpl deleted file mode 100644 index 495d812e..00000000 --- a/8.0/config/code-server/config.yaml.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -user-data-dir: {{ getenv "VSCODE_HOME" }} -bind-addr: 0.0.0.0:8080 -cert: false -{{ if (getenv "IDE_PASSWORD") }} -auth: password -password: {{ getenv "IDE_PASSWORD" }} -{{ else }} -auth: none -{{ end }} diff --git a/8.0/config/php/opcache.ini b/8.0/config/php/opcache.ini deleted file mode 100644 index bbc72325..00000000 --- a/8.0/config/php/opcache.ini +++ /dev/null @@ -1,3 +0,0 @@ -; Extention settings -[opcache] -opcache.preload=/var/www/.docksal/etc/php/preload.php diff --git a/8.0/config/php/xdebug.ini b/8.0/config/php/xdebug.ini deleted file mode 100644 index 90111271..00000000 --- a/8.0/config/php/xdebug.ini +++ /dev/null @@ -1,12 +0,0 @@ -[xdebug] -zend_extension=xdebug.so -; See https://xdebug.org/docs/all_settings#mode -xdebug.mode=debug -; xdebug.xdebug.client_host defaults to "localhost", which works with VS Code Server web IDE running locally -; For debugging from a "remote" host, xdebug.xdebug.client_host is set to ${DOCKSAL_HOST_IP} at runtime -; xdebug.xdebug.client_port defaults to "9003" in Xdebug 3. We use 9000 instead for backward compatibility with Xdebug 2. -xdebug.client_port=9000 -; TODO: Why do we have to set this? -xdebug.idekey=xdebug_session -; Increase max_nesting_level to support complex Drupal pages (default is 100) -xdebug.max_nesting_level=256 diff --git a/8.0/config/php/xhprof.ini b/8.0/config/php/xhprof.ini deleted file mode 100644 index 6c2e4dc9..00000000 --- a/8.0/config/php/xhprof.ini +++ /dev/null @@ -1,2 +0,0 @@ -[xhprof] -extension="xhprof.so" diff --git a/8.0/config/php/zz-php-fpm.conf b/8.0/config/php/zz-php-fpm.conf deleted file mode 100644 index d4fb5e22..00000000 --- a/8.0/config/php/zz-php-fpm.conf +++ /dev/null @@ -1,19 +0,0 @@ -; PHP-FPM settings - -[global] -; This pid file is used for Docker healthcheck -pid = /run/php-fpm.pid - -[www] -user = docker -catch_workers_output = yes -listen = 0.0.0.0:9000 -clear_env = no - -; PHP (FPM) settings -; See zz-php.ini for global (CLI and FPM) PHP settings -php_value[memory_limit] = 256M -php_value[max_execution_time] = 300 -php_value[upload_max_filesize] = 500M -php_value[post_max_size] = 500M -php_value[max_input_vars] = 2000 diff --git a/8.0/config/php/zz-php.ini b/8.0/config/php/zz-php.ini deleted file mode 100644 index aaf78a2e..00000000 --- a/8.0/config/php/zz-php.ini +++ /dev/null @@ -1,19 +0,0 @@ -; PHP global (CLI and FPM) settings -; To override settings for FPM use zz-php-fpm.conf -[php] -memory_limit = -1 -max_execution_time = 600 -date.timezone = UTC -display_errors = On -display_startup_errors = On - -[mail] -; Enable Mailhog integration by default -sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --from=docker@cli' - -; Extention settings -[opcache] -opcache.memory_consumption = 128 -[blackfire] -blackfire.agent_socket = 'tcp://blackfire:8307' -blackfire.apm_enabled = 0 diff --git a/8.0/config/supervisor/supervisord-code-server.conf.tmpl b/8.0/config/supervisor/supervisord-code-server.conf.tmpl deleted file mode 100644 index 7016f1a7..00000000 --- a/8.0/config/supervisor/supervisord-code-server.conf.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -# VS Code Server web IDE -[program:code-server] -# Using bash -lc here to load docker user profile (necessary for nvn/node to initialize) -command = gosu docker bash -lc '/usr/bin/code-server --config=${VSCODE_HOME}/config.yaml /var/www' -stdout_logfile = /var/log/supervisor/code-server-stdout -stderr_logfile = /var/log/supervisor/code-server-stderr diff --git a/8.0/config/supervisor/supervisord-crond.conf b/8.0/config/supervisor/supervisord-crond.conf deleted file mode 100644 index 33dbd8e1..00000000 --- a/8.0/config/supervisor/supervisord-crond.conf +++ /dev/null @@ -1,5 +0,0 @@ -[program:cron] -# Cron will only log to syslog and nothing else... -command = /usr/sbin/cron -f -stdout_logfile = /var/log/supervisor/cron-stdout -stderr_logfile = /var/log/supervisor/cron-stderr diff --git a/8.0/config/supervisor/supervisord-php-fpm.conf b/8.0/config/supervisor/supervisord-php-fpm.conf deleted file mode 100644 index b4420872..00000000 --- a/8.0/config/supervisor/supervisord-php-fpm.conf +++ /dev/null @@ -1,4 +0,0 @@ -[program:php-fpm] -command = /usr/local/sbin/php-fpm -stdout_logfile = /var/log/supervisor/php-fpm-stdout -stderr_logfile = /var/log/supervisor/php-fpm-stderr diff --git a/8.0/config/supervisor/supervisord-sshd.conf b/8.0/config/supervisor/supervisord-sshd.conf deleted file mode 100644 index de159108..00000000 --- a/8.0/config/supervisor/supervisord-sshd.conf +++ /dev/null @@ -1,4 +0,0 @@ -[program:sshd] -command = /usr/sbin/sshd -D -stdout_logfile = /var/log/supervisor/sshd-stdout -stderr_logfile = /var/log/supervisor/sshd-stderr diff --git a/8.0/config/supervisor/supervisord.conf b/8.0/config/supervisor/supervisord.conf deleted file mode 100644 index 32c7217a..00000000 --- a/8.0/config/supervisor/supervisord.conf +++ /dev/null @@ -1,6 +0,0 @@ -[supervisord] -nodaemon = true -# debug prints output from all services to stdout/stderr. -# This way logs can be reviewed with docker logs. -# Additionalluy, logs from specific services are forwarded to individual files on disk. -loglevel = debug diff --git a/8.0/healthcheck.sh b/8.0/healthcheck.sh deleted file mode 100755 index b4ab59d0..00000000 --- a/8.0/healthcheck.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -# Initialization phase in startup.sh is complete -[[ -f /var/run/cli ]] || exit 1 - -# supervisor services are running -if [[ -f /run/supervisord.pid ]]; then - if [[ "${IDE_ENABLED}" == "1" ]]; then - # IDE mode - ps aux | grep code-server >/dev/null || exit 1 - else - # php-fpm/cli mode - [[ -f /run/php-fpm.pid ]] || exit 1 - [[ -f /run/sshd.pid ]] || exit 1 - fi -fi diff --git a/8.0/ping-web.sh b/8.0/ping-web.sh deleted file mode 100755 index 6a5ba7b8..00000000 --- a/8.0/ping-web.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Notify web container about started fin exec -if [[ "${WEB_KEEPALIVE}" != "0" ]] && [[ "${VIRTUAL_HOST}" != "" ]] -then - while true - do - curl -s -m 1 ${VIRTUAL_HOST}/exec_in_progress_inside_cli >/dev/null 2>&1 - sleep ${WEB_KEEPALIVE} - done -fi diff --git a/8.0/startup.sh b/8.0/startup.sh deleted file mode 100755 index 7861a81d..00000000 --- a/8.0/startup.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/bash - -# This script is running as root by default. -# Switching to the docker user can be done via "gosu docker ". - -HOME_DIR='/home/docker' - -DEBUG=${DEBUG:-0} -# Turn debugging ON when cli is started in the service mode -[[ "$1" == "supervisord" ]] && DEBUG=1 -echo-debug () -{ - [[ "$DEBUG" != 0 ]] && echo "$(date +"%F %H:%M:%S") | $@" -} - -uid_gid_reset () -{ - if [[ "$HOST_UID" != "$(id -u docker)" ]] || [[ "$HOST_GID" != "$(id -g docker)" ]]; then - echo-debug "Updating docker user uid/gid to $HOST_UID/$HOST_GID to match the host user uid/gid..." - usermod -u "$HOST_UID" -o docker - groupmod -g "$HOST_GID" -o "$(id -gn docker)" - fi -} - -xdebug_enable () -{ - echo-debug "Enabling xdebug..." - ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ -} - -xhprof_enable () -{ - echo-debug "Enabling xhprof..." - cp /opt/docker-php-ext-xhprof.ini /usr/local/etc/php/conf.d/ - # Output directory to the ini file - echo "xhprof.output_dir = ${XHPROF_OUTPUT_DIR}" >> /usr/local/etc/php/conf.d/docker-php-ext-xhprof.ini - # Try to create directory if it doesn't exist - mkdir ${XHPROF_OUTPUT_DIR} || true - # Change owner of directory - chown docker:docker ${XHPROF_OUTPUT_DIR} -} - -opcache_preload_enable() -{ - echo-debug "Enabling opcache preload..." - ln -s /opt/docker-php-ext-opcache.ini /usr/local/etc/php/conf.d/ -} - -ide_mode_enable () -{ - echo-debug "Enabling web IDE..." - # Enabled only code-server service (disabled all other services) - # TODO: split IDE/cli and php-fpm entirely - rm -f /etc/supervisor/conf.d/supervisord-*.conf - render_tmpl "/etc/supervisor/conf.d/supervisord-code-server.conf" - render_tmpl "${VSCODE_HOME}/config.yaml" -} - -# Creates symlinks to project level overrides if they exist -php_settings () -{ - php_ini=/var/www/.docksal/etc/php/php.ini - if [[ -f ${php_ini} ]]; then - echo-debug "Found project level overrides for PHP. Including:" - echo-debug "${php_ini}" - ln -s /var/www/.docksal/etc/php/php.ini /usr/local/etc/php/conf.d/zzz-php.ini - fi - - php_fpm_conf=/var/www/.docksal/etc/php/php-fpm.conf - if [[ -f ${php_fpm_conf} ]]; then - echo-debug "Found project level overrides for PHP-FPM. Including:" - echo-debug "${php_fpm_conf}" - ln -s ${php_fpm_conf} /usr/local/etc/php-fpm.d/zzz-php-fpm.conf - fi -} - -add_ssh_key () -{ - echo-debug "Adding a private SSH key from SECRET_SSH_PRIVATE_KEY..." - render_tmpl "$HOME_DIR/.ssh/id_rsa" - chmod 0600 "$HOME_DIR/.ssh/id_rsa" -} - -# Helper function to render configs from go templates using gomplate -render_tmpl () -{ - local file="${1}" - local tmpl="${1}.tmpl" - - if [[ -f "${tmpl}" ]]; then - echo-debug "Rendering template: ${tmpl}..." - # gomplate started throwing an empty line into stderr in v3.7.0, so we have to mute it below - gomplate --file "${tmpl}" --out "${file}" &>/dev/null - else - echo-debug "Error: Template file not found: ${tmpl}" - return 1 - fi -} - -# Helper function to loop through all environment variables prefixed with SECRET_ and -# convert to the equivalent variable without SECRET. -# Example: SECRET_TERMINUS_TOKEN => TERMINUS_TOKEN. -convert_secrets () -{ - eval 'secrets=(${!SECRET_@})' - for secret_key in "${secrets[@]}"; do - key=${secret_key#SECRET_} - secret_value=${!secret_key} - - # Write new variables to /etc/profile.d/secrets.sh to make them available for all users/sessions - echo "export ${key}=\"${secret_value}\"" | tee -a "/etc/profile.d/secrets.sh" >/dev/null - - # Also export new variables here - # This makes them available in the server/php-fpm environment - eval "export ${key}=${secret_value}" - done -} - -# Pantheon (terminus) login -terminus_login () -{ - echo-debug "Authenticating with Pantheon..." - # This has to be done using the docker user via su to load the user environment - # Note: Using 'su -l' to initiate a login session and have .profile sourced for the docker user - local command="terminus auth:login --no-interaction --machine-token='${TERMINUS_TOKEN}'" - local output=$(su -l docker -c "${command}") - if [[ $? != 0 ]]; then - echo-debug "ERROR: Pantheon authentication failed." - echo - echo "$output" - echo - fi -} - -# Acquia CLI login -acli_login () -{ - echo-debug "Authenticating with Acquia..." - # This has to be done using the docker user via su to load the user environment - # Note: Using 'su -l' to initiate a login session and have .profile sourced for the docker user - local command="acli auth:login --key='${ACQUIA_CLI_KEY}' --secret='${ACQUIA_CLI_SECRET}' --no-interaction" - local output=$(su -l docker -c "${command}" 2>&1) - if [[ $? != 0 ]]; then - echo-debug "ERROR: Acquia authentication failed." - echo - echo "$output" - echo - fi -} - -# Git settings -git_settings () -{ - # These must be run as the docker user - echo-debug "Configuring git..." - # Set default git settings if none have been passed - # See https://github.com/docksal/service-cli/issues/124 - gosu docker git config --global user.email "${GIT_USER_EMAIL:-cli@docksal.io}" - gosu docker git config --global user.name "${GIT_USER_NAME:-Docksal CLI}" -} - -# Inject a private SSH key if provided -[[ "$SECRET_SSH_PRIVATE_KEY" != "" ]] && add_ssh_key - -# Set Composer Version -[[ "${COMPOSER_DEFAULT_VERSION}" != "" ]] && [[ -f /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} ]] && ln -sf /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} /usr/local/bin/composer - -# Convert all Environment Variables Prefixed with SECRET_ -convert_secrets - -# Docker user uid/gid mapping to the host user uid/gid -[[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset - -# Enable xdebug -[[ "$XDEBUG_ENABLED" != "" ]] && [[ "$XDEBUG_ENABLED" != "0" ]] && xdebug_enable - -# Enable xdebug -[[ "$XHPROF_ENABLED" != "" ]] && [[ "$XHPROF_ENABLED" != "0" ]] && xhprof_enable - -# Enable opcache preload -[[ -f "/var/www/.docksal/etc/php/preload.php" ]] && opcache_preload_enable - -# Enable web IDE -[[ "$IDE_ENABLED" != "" ]] && [[ "$IDE_ENABLED" != "0" ]] && ide_mode_enable - -# Include project level PHP settings if found -php_settings - -# Make sure permissions are correct (after uid/gid change and COPY operations in Dockerfile) -# To not bloat the image size, permissions on the home folder are reset at runtime. -echo-debug "Resetting permissions on $HOME_DIR and /var/www..." -chown "${HOST_UID:-1000}:${HOST_GID:-1000}" -R "$HOME_DIR" -# Docker resets the project root folder permissions to 0:0 when cli is recreated (e.g. an env variable updated). -# We apply a fix/workaround for this at startup (non-recursive). -chown "${HOST_UID:-1000}:${HOST_GID:-1000}" /var/www - -# These have to happen after the home directory permissions are reset, -# otherwise the docker user may not have write access to /home/docker, where the auth session data is stored. -# Automatically authenticate with Pantheon if Terminus token is present -[[ "$TERMINUS_TOKEN" != "" ]] && terminus_login - -# Authenticate to Acquia CLI -[[ "$ACQUIA_CLI_KEY" != "" ]] && [[ "$ACQUIA_CLI_SECRET" != "" ]] && acli_login - -# If crontab file is found within project add contents to user crontab file. -if [[ -f ${PROJECT_ROOT}/.docksal/services/cli/crontab ]]; then - echo-debug "Loading crontab..." - cat ${PROJECT_ROOT}/.docksal/services/cli/crontab | crontab -u docker - -fi - -# Apply git settings -[[ "$GIT_USER_EMAIL" != "" ]] && [[ "$GIT_USER_NAME" != "" ]] && git_settings - -# Initialization steps completed. Create a pid file to mark the container as healthy -echo-debug "Preliminary initialization completed." -touch /var/run/cli - -# Execute a custom startup script if present -if [[ -x ${PROJECT_ROOT}/.docksal/services/cli/startup.sh ]]; then - echo-debug "Running custom startup script..." - # TODO: should we source the script instead? - su -l docker -c "${PROJECT_ROOT}/.docksal/services/cli/startup.sh" - if [[ $? == 0 ]]; then - echo-debug "Custom startup script executed successfully." - else - echo-debug "ERROR: Custom startup script execution failed." - fi -fi - -# Execute passed CMD arguments -echo-debug "Passing execution to: $*" -# Service mode (run as root) -if [[ "$1" == "supervisord" ]]; then - exec gosu root supervisord -c /etc/supervisor/supervisord.conf -# Command mode (run as docker user) -else - exec gosu docker "$@" -fi diff --git a/8.0/tests/essential-binaries.sh b/8.0/tests/essential-binaries.sh deleted file mode 100755 index 480d8b91..00000000 --- a/8.0/tests/essential-binaries.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -binaries_amd64=\ -'bundler -cat -convert -curl -dig -g++ -ghostscript -git -git-lfs -gcc -jq -html2text -less -make -mc -more -mysql -nano -node -nvm -nslookup -php -ping -pip -psql -pv -python3 -rsync -ruby -sudo -unzip -wget -yq -zip' - -binaries_arm64=\ -'bundler -cat -convert -curl -dig -g++ -ghostscript -git -git-lfs -gcc -jq -html2text -less -make -mc -more -mysql -nano -node -nvm -nslookup -php -ping -psql -pv -python3 -rsync -ruby -sudo -unzip -wget -yq -zip' - -# Use the docker reported architecture and not the hosts (uname -m). -# docker arch may not be the same as hosts's arch (e.g., when using a remote docker instance). -case "$(docker info -f '{{ .Architecture }}')" in - x86_64) echo "${binaries_amd64}" ;; - amd64) echo "${binaries_amd64}" ;; - aarch64) echo "${binaries_arm64}" ;; - arm64) echo "${binaries_arm64}" ;; - * ) false;; -esac diff --git a/8.0/tests/php-modules.sh b/8.0/tests/php-modules.sh deleted file mode 100755 index 0d671ced..00000000 --- a/8.0/tests/php-modules.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env bash - -php_modules_amd64=\ -'[PHP Modules] -apcu -bcmath -blackfire -bz2 -calendar -Core -ctype -curl -date -dom -exif -fileinfo -filter -ftp -gd -gettext -gnupg -hash -iconv -imagick -imap -intl -json -ldap -libxml -mbstring -memcached -mysqli -mysqlnd -openssl -pcntl -pcre -PDO -pdo_mysql -pdo_pgsql -pdo_sqlite -pdo_sqlsrv -pgsql -Phar -posix -readline -redis -Reflection -session -SimpleXML -soap -sockets -sodium -SPL -sqlite3 -sqlsrv -ssh2 -standard -sysvsem -tokenizer -xml -xmlreader -xmlwriter -xsl -Zend OPcache -zip -zlib - -[Zend Modules] -Zend OPcache -blackfire -' - -php_modules_arm64=\ -'[PHP Modules] -apcu -bcmath -blackfire -bz2 -calendar -Core -ctype -curl -date -dom -exif -fileinfo -filter -ftp -gd -gettext -gnupg -hash -iconv -imagick -imap -intl -json -ldap -libxml -mbstring -memcached -mysqli -mysqlnd -openssl -pcntl -pcre -PDO -pdo_mysql -pdo_pgsql -pdo_sqlite -pdo_sqlsrv -pgsql -Phar -posix -readline -redis -Reflection -session -SimpleXML -soap -sockets -sodium -SPL -sqlite3 -sqlsrv -ssh2 -standard -sysvsem -tokenizer -xml -xmlreader -xmlwriter -xsl -Zend OPcache -zip -zlib - -[Zend Modules] -Zend OPcache -blackfire -' - -# Use the docker reported architecture and not the hosts (uname -m). -# docker arch may not be the same as hosts's arch (e.g., when using a remote docker instance). -case "$(docker info -f '{{ .Architecture }}')" in - x86_64) echo "${php_modules_amd64}" ;; - amd64) echo "${php_modules_amd64}" ;; - aarch64) echo "${php_modules_arm64}" ;; - arm64) echo "${php_modules_arm64}" ;; - * ) false;; -esac From b2e2ee131df23411421157a7b7f46faded2d2497 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 16:13:40 +0100 Subject: [PATCH 02/23] Switched base to Debian 12 (bookworm) --- 8.1/Dockerfile | 2 +- 8.2/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 90174cda..6481b2df 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1.25-fpm-bullseye as cli +FROM php:8.1.25-fpm-bookworm as cli ARG TARGETARCH ARG DEBIAN_FRONTEND=noninteractive diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 1783f413..83feace6 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.2.12-fpm-bullseye as cli +FROM php:8.2.12-fpm-bookworm as cli ARG TARGETARCH ARG DEBIAN_FRONTEND=noninteractive From e0b1f01e931b77fffe1b05d345f4abf8782df36d Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 17:01:50 +0100 Subject: [PATCH 03/23] Dropped blackfire PHP extension --- 8.1/Dockerfile | 11 +---------- 8.1/config/php/zz-php.ini | 3 --- 8.1/tests/php-modules.sh | 4 ---- 8.2/Dockerfile | 11 +---------- 8.2/config/php/zz-php.ini | 3 --- 8.2/tests/php-modules.sh | 4 ---- 6 files changed, 2 insertions(+), 34 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 6481b2df..3cb4be2d 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -31,9 +31,6 @@ ENV LC_ALL en_US.utf8 # Enable additional repos RUN set -xe; \ sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # blackfire.io repo - curl -fsSL https://packages.blackfire.io/gpg.key | apt-key add -; \ - echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ # git-lfs repo curl -fsSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ echo 'deb https://packagecloud.io/github/git-lfs/debian bullseye main' | tee /etc/apt/sources.list.d/github_git-lfs.list; @@ -140,7 +137,6 @@ RUN set -xe; \ apt-get update >/dev/null; \ apt-get -y --no-install-recommends install >/dev/null \ $buildDeps \ - blackfire-php \ libc-client2007e \ libfreetype6 \ libgpgme11 \ @@ -257,7 +253,6 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - BLACKFIRE_VERSION=2.10.0 \ PLATFORMSH_CLI_VERSION=4.10.4 \ ACQUIA_CLI_VERSION=2.18.0 \ TERMINUS_VERSION=3.2.2 \ @@ -274,10 +269,6 @@ RUN set -xe; \ curl -fsSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_LAUNCHER_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ # Wordpress CLI curl -fsSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Blackfire CLI - # Find out the most recent version number: - # curl -X GET -Is https://blackfire.io/api/v1/releases/cli/linux/amd64 | grep location | awk '{print $2}' - curl -fsSL "https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${TARGETARCH}" -o /usr/local/bin/blackfire; \ # Platform.sh CLI curl -fsSL "https://github.com/platformsh/legacy-cli/releases/download/v${PLATFORMSH_CLI_VERSION}/platform.phar" -o /usr/local/bin/platform; \ # Acquia CLI @@ -291,7 +282,7 @@ RUN set -xe; \ # Set Default Composer Version ln -s /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} /usr/local/bin/composer; \ # Make all downloaded binaries executable in one shot - (cd /usr/local/bin && chmod +x composer1 composer2 drush8 drupal wp blackfire platform acli terminus jq yq); + (cd /usr/local/bin && chmod +x composer1 composer2 drush8 drupal wp platform acli terminus jq yq); # Install Python 3 + pip from Debian repos RUN set -xe; \ diff --git a/8.1/config/php/zz-php.ini b/8.1/config/php/zz-php.ini index aaf78a2e..c7ece851 100644 --- a/8.1/config/php/zz-php.ini +++ b/8.1/config/php/zz-php.ini @@ -14,6 +14,3 @@ sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --from=docker@cli' ; Extention settings [opcache] opcache.memory_consumption = 128 -[blackfire] -blackfire.agent_socket = 'tcp://blackfire:8307' -blackfire.apm_enabled = 0 diff --git a/8.1/tests/php-modules.sh b/8.1/tests/php-modules.sh index 0d671ced..a74431a5 100755 --- a/8.1/tests/php-modules.sh +++ b/8.1/tests/php-modules.sh @@ -4,7 +4,6 @@ php_modules_amd64=\ '[PHP Modules] apcu bcmath -blackfire bz2 calendar Core @@ -67,14 +66,12 @@ zlib [Zend Modules] Zend OPcache -blackfire ' php_modules_arm64=\ '[PHP Modules] apcu bcmath -blackfire bz2 calendar Core @@ -137,7 +134,6 @@ zlib [Zend Modules] Zend OPcache -blackfire ' # Use the docker reported architecture and not the hosts (uname -m). diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 83feace6..32980d9c 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -31,9 +31,6 @@ ENV LC_ALL en_US.utf8 # Enable additional repos RUN set -xe; \ sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # blackfire.io repo - curl -fsSL https://packages.blackfire.io/gpg.key | apt-key add -; \ - echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ # git-lfs repo curl -fsSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ echo 'deb https://packagecloud.io/github/git-lfs/debian bullseye main' | tee /etc/apt/sources.list.d/github_git-lfs.list; @@ -140,7 +137,6 @@ RUN set -xe; \ apt-get update >/dev/null; \ apt-get -y --no-install-recommends install >/dev/null \ $buildDeps \ - blackfire-php \ libc-client2007e \ libfreetype6 \ libgpgme11 \ @@ -257,7 +253,6 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - BLACKFIRE_VERSION=2.10.0 \ PLATFORMSH_CLI_VERSION=4.10.4 \ ACQUIA_CLI_VERSION=2.18.0 \ TERMINUS_VERSION=3.2.2 \ @@ -274,10 +269,6 @@ RUN set -xe; \ curl -fsSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_LAUNCHER_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ # Wordpress CLI curl -fsSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Blackfire CLI - # Find out the most recent version number: - # curl -X GET -Is https://blackfire.io/api/v1/releases/cli/linux/amd64 | grep location | awk '{print $2}' - curl -fsSL "https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${TARGETARCH}" -o /usr/local/bin/blackfire; \ # Platform.sh CLI curl -fsSL "https://github.com/platformsh/legacy-cli/releases/download/v${PLATFORMSH_CLI_VERSION}/platform.phar" -o /usr/local/bin/platform; \ # Acquia CLI @@ -291,7 +282,7 @@ RUN set -xe; \ # Set Default Composer Version ln -s /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} /usr/local/bin/composer; \ # Make all downloaded binaries executable in one shot - (cd /usr/local/bin && chmod +x composer1 composer2 drush8 drupal wp blackfire platform acli terminus jq yq); + (cd /usr/local/bin && chmod +x composer1 composer2 drush8 drupal wp platform acli terminus jq yq); # Install Python 3 + pip from Debian repos RUN set -xe; \ diff --git a/8.2/config/php/zz-php.ini b/8.2/config/php/zz-php.ini index aaf78a2e..c7ece851 100644 --- a/8.2/config/php/zz-php.ini +++ b/8.2/config/php/zz-php.ini @@ -14,6 +14,3 @@ sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --from=docker@cli' ; Extention settings [opcache] opcache.memory_consumption = 128 -[blackfire] -blackfire.agent_socket = 'tcp://blackfire:8307' -blackfire.apm_enabled = 0 diff --git a/8.2/tests/php-modules.sh b/8.2/tests/php-modules.sh index c869be2b..e0a1f3fd 100755 --- a/8.2/tests/php-modules.sh +++ b/8.2/tests/php-modules.sh @@ -4,7 +4,6 @@ php_modules_amd64=\ '[PHP Modules] apcu bcmath -blackfire bz2 calendar Core @@ -68,14 +67,12 @@ zlib [Zend Modules] Zend OPcache -blackfire ' php_modules_arm64=\ '[PHP Modules] apcu bcmath -blackfire bz2 calendar Core @@ -139,7 +136,6 @@ zlib [Zend Modules] Zend OPcache -blackfire ' # Use the docker reported architecture and not the hosts (uname -m). From cf3aee4b7ee7a68bac11757319fee7b9a50aa058 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 17:02:41 +0100 Subject: [PATCH 04/23] Dropped additional repos --- 8.1/Dockerfile | 7 ------- 8.2/Dockerfile | 7 ------- 2 files changed, 14 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 3cb4be2d..a0b0eb8e 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -28,13 +28,6 @@ RUN set -xe; \ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LC_ALL en_US.utf8 -# Enable additional repos -RUN set -xe; \ - sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # git-lfs repo - curl -fsSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian bullseye main' | tee /etc/apt/sources.list.d/github_git-lfs.list; - # Additional packages RUN set -xe; \ # Create man direcotries, otherwise some packages may not install (e.g. postgresql-client) diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 32980d9c..22305d7a 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -28,13 +28,6 @@ RUN set -xe; \ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LC_ALL en_US.utf8 -# Enable additional repos -RUN set -xe; \ - sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # git-lfs repo - curl -fsSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian bullseye main' | tee /etc/apt/sources.list.d/github_git-lfs.list; - # Additional packages RUN set -xe; \ # Create man direcotries, otherwise some packages may not install (e.g. postgresql-client) From a683469107569d787ac31ca9c7efcebdf546b03f Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 17:03:21 +0100 Subject: [PATCH 05/23] Updated package versions for Debian 12 --- 8.1/Dockerfile | 6 +++--- 8.2/Dockerfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index a0b0eb8e..8d606252 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -133,10 +133,10 @@ RUN set -xe; \ libc-client2007e \ libfreetype6 \ libgpgme11 \ - libicu67 \ + libicu72 \ libjpeg62-turbo \ - libldap-2.4-2 \ - libmagickcore-6.q16-*-extra \ + libldap-2.5-0 \ + libmagickcore-6.q16-6-extra \ libmagickwand-6.q16-6 \ libmemcached11 \ libmemcachedutil2 \ diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 22305d7a..9f287e31 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -133,10 +133,10 @@ RUN set -xe; \ libc-client2007e \ libfreetype6 \ libgpgme11 \ - libicu67 \ + libicu72 \ libjpeg62-turbo \ - libldap-2.4-2 \ - libmagickcore-6.q16-*-extra \ + libldap-2.5-0 \ + libmagickcore-6.q16-6-extra \ libmagickwand-6.q16-6 \ libmemcached11 \ libmemcachedutil2 \ From a9ce72f5c8e4982365a0d3f21a75ab597a22d13e Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 17:23:29 +0100 Subject: [PATCH 06/23] Fix tests (blackfire) --- tests/env_make | 2 -- tests/test.bats | 5 ----- 2 files changed, 7 deletions(-) diff --git a/tests/env_make b/tests/env_make index 57a31e52..faf36c5f 100644 --- a/tests/env_make +++ b/tests/env_make @@ -1,7 +1,5 @@ ENV = \ -e XDEBUG_ENABLED \ - -e SECRET_BLACKFIRE_CLIENT_ID \ - -e SECRET_BLACKFIRE_CLIENT_TOKEN \ -e SECRET_SSH_PRIVATE_KEY \ -e SECRET_PLATFORMSH_CLI_TOKEN \ -e SECRET_TERMINUS_TOKEN diff --git a/tests/test.bats b/tests/test.bats index f97450dc..0659e57e 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -333,11 +333,6 @@ _healthcheck_wait () ### Tests ### - # Check Blackfire CLI version - run docker exec -u docker "$NAME" bash -lc 'blackfire version | grep "${BLACKFIRE_VERSION}"' - [[ ${status} == 0 ]] - unset output - # Check msmtp run docker exec -u docker "$NAME" which msmtp echo "$output" | grep "/usr/bin/msmtp" From 49946f74f74828be4c23ebcdeaab2764d4cdd921 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 19:26:11 +0100 Subject: [PATCH 07/23] Updated tests - Moved node, ruby, and python test cases into "misc tools" test - Re-enabled terminus test - Cleaned up Dockerfiles from legacy code --- 8.1/Dockerfile | 82 ++----------------------------------------------- 8.2/Dockerfile | 82 ++----------------------------------------------- tests/test.bats | 78 +++++----------------------------------------- 3 files changed, 12 insertions(+), 230 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 8d606252..f2fe86f2 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -188,7 +188,7 @@ RUN set -xe; \ imagick \ memcached \ redis \ - ssh2-beta \ + ssh2 \ xdebug \ xhprof \ ;\ @@ -211,7 +211,7 @@ RUN set -xe; \ # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). - #curl -fsSL https://packages.microsoft.com/config/debian/11/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + #curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ \ buildDeps=" \ @@ -340,52 +340,6 @@ RUN set -e; \ export YARN_PROFILE="$HOME/.profile"; \ curl -fsSL https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} >/dev/null -## Ruby (installed as user) via rvm -## Note: Disabled. rvm + its build dependecies bloat the image (~80MB) -## Debian 11 ships with Ruby 2.7, so we'll stick with that by default. -## It is still possible for the end user to switch to a different Ruby version via rvm. -#ENV \ -# RVM_VERSION_INSTALL=1.29.10 \ -# RUBY_VERSION_INSTALL=2.7.2 -## Don't use -x here, as the output may be excessive -#RUN set -e; \ -# # Export ruby gem bin path -# echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \ -# . $HOME/.profile; \ -# # Public GPG servers are not realiable, so downloading keys from rvm.io instead. -# #gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB -# # Import and trust rvm keys -# # mpapis@gmail.com -# curl -sSL https://rvm.io/mpapis.asc | gpg --batch --import -; \ -# echo 409B6B1796C275462A1703113804BB82D39DC0E3:6: | gpg --batch --import-ownertrust; \ -# # piotr.kuczynski@gmail.com -# curl -sSL https://rvm.io/pkuczynski.asc | gpg --batch --import -; \ -# echo 7D2BAF1CF37B13E2069D6956105BD0E739499BDB:6: | gpg --batch --import-ownertrust; \ -# \ -# echo 'rvm_autoupdate_flag=0' >> $HOME/.rvmrc; \ -# echo 'rvm_silence_path_mismatch_check_flag=1' >> $HOME/.rvmrc; \ -# curl -fsSL https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION_INSTALL}/binscripts/rvm-installer | bash -s -- --ignore-dotfiles --version ${RVM_VERSION_INSTALL}; \ -# { \ -# echo ''; \ -# echo 'export PATH="$PATH:$HOME/.rvm/bin"'; \ -# echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'; \ -# } >> $HOME/.profile; \ -# # Reload $HOME/.profile to apply settings for the current shell -# . $HOME/.profile; \ -# \ -# # rvm.io does not currently have ruby binaries for Debian 9, so Ruby is compiled from source, which requires a bunch -# # of extra dependencies installed (rvm installs these automatically), which bloat this image: -# # rvm/ruby required packages: gawk, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev -# rvm install ruby-${RUBY_VERSION_INSTALL}; \ -# rvm use ruby-${RUBY_VERSION_INSTALL} --default; \ -# \ -# gem install --user-install bundler; \ -# # Have bundler install gems locally (./.bundle) by default -# echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile; \ -# \ -# rvm cleanup all; \ -# rvm gemset globalcache enable - ## Ruby bundler ## Don't use -x here, as the output may be excessive RUN set -e; \ @@ -396,38 +350,6 @@ RUN set -e; \ # Have bundler install gems in the current directory (./.bundle) by default echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile -# Python (installed as user) via pyenv -# Note: Disabled. pyenv + its build dependecies bloat the image (~300MB). -# Debian 10 ships with Python 3.7, so we'll stick with that by default. -# It is still possible for the end user to switch to a different python version via pyenv. -#ENV \ -# PYENV_VERSION_INSTALL=1.2.21 \ -# PYTHON_VERSION_INSTALL=3.8.3 -#RUN set -xe; \ -# # pyenv requires a bunch of build dependencies installed, which would bloat this image -# # See https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites -# sudo apt-get update >/dev/null; \ -# sudo apt-get -y --no-install-recommends install >/dev/null \ -# build-essential libssl-dev zlib1g-dev libbz2-dev \ -# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ -# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \ -# ;\ -# # Cleanup -# sudo apt-get clean; sudo rm -rf /var/lib/apt/lists/*; \ -# \ -# git clone --depth 1 -b v${PYENV_VERSION_INSTALL} https://github.com/pyenv/pyenv.git $HOME/.pyenv; \ -# rm -rf $HOME/.pyenv/.git; \ -# { \ -# echo ''; \ -# echo 'export PYENV_ROOT="$HOME/.pyenv"'; \ -# echo 'export PATH="$PYENV_ROOT/bin:$PATH"'; \ -# echo 'eval "$(pyenv init -)"'; \ -# } >> $HOME/.profile; \ -# # Reload $HOME/.profile to apply settings for the current shell -# . $HOME/.profile; \ -# pyenv install ${PYTHON_VERSION_INSTALL}; \ -# pyenv global ${PYTHON_VERSION_INSTALL} - # Notify web container about started fin exec RUN echo '(/opt/ping-web.sh &)' >> $HOME/.profile diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 9f287e31..64929680 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -188,7 +188,7 @@ RUN set -xe; \ imagick \ memcached \ redis \ - ssh2-beta \ + ssh2 \ xdebug \ xhprof \ ;\ @@ -211,7 +211,7 @@ RUN set -xe; \ # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). - #curl -fsSL https://packages.microsoft.com/config/debian/11/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + #curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ \ buildDeps=" \ @@ -340,52 +340,6 @@ RUN set -e; \ export YARN_PROFILE="$HOME/.profile"; \ curl -fsSL https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} >/dev/null -## Ruby (installed as user) via rvm -## Note: Disabled. rvm + its build dependecies bloat the image (~80MB) -## Debian 11 ships with Ruby 2.7, so we'll stick with that by default. -## It is still possible for the end user to switch to a different Ruby version via rvm. -#ENV \ -# RVM_VERSION_INSTALL=1.29.10 \ -# RUBY_VERSION_INSTALL=2.7.2 -## Don't use -x here, as the output may be excessive -#RUN set -e; \ -# # Export ruby gem bin path -# echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \ -# . $HOME/.profile; \ -# # Public GPG servers are not realiable, so downloading keys from rvm.io instead. -# #gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB -# # Import and trust rvm keys -# # mpapis@gmail.com -# curl -sSL https://rvm.io/mpapis.asc | gpg --batch --import -; \ -# echo 409B6B1796C275462A1703113804BB82D39DC0E3:6: | gpg --batch --import-ownertrust; \ -# # piotr.kuczynski@gmail.com -# curl -sSL https://rvm.io/pkuczynski.asc | gpg --batch --import -; \ -# echo 7D2BAF1CF37B13E2069D6956105BD0E739499BDB:6: | gpg --batch --import-ownertrust; \ -# \ -# echo 'rvm_autoupdate_flag=0' >> $HOME/.rvmrc; \ -# echo 'rvm_silence_path_mismatch_check_flag=1' >> $HOME/.rvmrc; \ -# curl -fsSL https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION_INSTALL}/binscripts/rvm-installer | bash -s -- --ignore-dotfiles --version ${RVM_VERSION_INSTALL}; \ -# { \ -# echo ''; \ -# echo 'export PATH="$PATH:$HOME/.rvm/bin"'; \ -# echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'; \ -# } >> $HOME/.profile; \ -# # Reload $HOME/.profile to apply settings for the current shell -# . $HOME/.profile; \ -# \ -# # rvm.io does not currently have ruby binaries for Debian 9, so Ruby is compiled from source, which requires a bunch -# # of extra dependencies installed (rvm installs these automatically), which bloat this image: -# # rvm/ruby required packages: gawk, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev -# rvm install ruby-${RUBY_VERSION_INSTALL}; \ -# rvm use ruby-${RUBY_VERSION_INSTALL} --default; \ -# \ -# gem install --user-install bundler; \ -# # Have bundler install gems locally (./.bundle) by default -# echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile; \ -# \ -# rvm cleanup all; \ -# rvm gemset globalcache enable - ## Ruby bundler ## Don't use -x here, as the output may be excessive RUN set -e; \ @@ -396,38 +350,6 @@ RUN set -e; \ # Have bundler install gems in the current directory (./.bundle) by default echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile -# Python (installed as user) via pyenv -# Note: Disabled. pyenv + its build dependecies bloat the image (~300MB). -# Debian 10 ships with Python 3.7, so we'll stick with that by default. -# It is still possible for the end user to switch to a different python version via pyenv. -#ENV \ -# PYENV_VERSION_INSTALL=1.2.21 \ -# PYTHON_VERSION_INSTALL=3.8.3 -#RUN set -xe; \ -# # pyenv requires a bunch of build dependencies installed, which would bloat this image -# # See https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites -# sudo apt-get update >/dev/null; \ -# sudo apt-get -y --no-install-recommends install >/dev/null \ -# build-essential libssl-dev zlib1g-dev libbz2-dev \ -# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ -# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \ -# ;\ -# # Cleanup -# sudo apt-get clean; sudo rm -rf /var/lib/apt/lists/*; \ -# \ -# git clone --depth 1 -b v${PYENV_VERSION_INSTALL} https://github.com/pyenv/pyenv.git $HOME/.pyenv; \ -# rm -rf $HOME/.pyenv/.git; \ -# { \ -# echo ''; \ -# echo 'export PYENV_ROOT="$HOME/.pyenv"'; \ -# echo 'export PATH="$PYENV_ROOT/bin:$PATH"'; \ -# echo 'eval "$(pyenv init -)"'; \ -# } >> $HOME/.profile; \ -# # Reload $HOME/.profile to apply settings for the current shell -# . $HOME/.profile; \ -# pyenv install ${PYTHON_VERSION_INSTALL}; \ -# pyenv global ${PYTHON_VERSION_INSTALL} - # Notify web container about started fin exec RUN echo '(/opt/ping-web.sh &)' >> $HOME/.profile diff --git a/tests/test.bats b/tests/test.bats index 0659e57e..4cfe3734 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -217,14 +217,9 @@ _healthcheck_wait () unset output # Check Terminus version - # Terminus v3 is not yet fully compatible with PHP 8.1 - # TODO: Re-enable tests for Terminus v3 on PHP 8.1 once stable. - # See: https://github.com/pantheon-systems/terminus/issues/2256 - if [[ "${VERSION}" != "8.1" ]]; then - run docker exec -u docker "$NAME" bash -lc 'set -x; terminus --version | grep "^Terminus ${TERMINUS_VERSION}$"' - [[ ${status} == 0 ]] - unset output - fi + run docker exec -u docker "$NAME" bash -lc 'set -x; terminus --version | grep "^Terminus ${TERMINUS_VERSION}$"' + [[ ${status} == 0 ]] + unset output # Check Platform CLI version run docker exec -u docker "$NAME" bash -lc 'set -x; platform --version | grep "Platform.sh CLI ${PLATFORMSH_CLI_VERSION}"' @@ -240,7 +235,7 @@ _healthcheck_wait () make clean } -@test "Check NodeJS tools and versions" { +@test "Check misc tools and versions" { [[ $SKIP == 1 ]] && skip ### Setup ### @@ -266,73 +261,16 @@ _healthcheck_wait () [[ ${status} == 0 ]] unset output - ### Cleanup ### - make clean -} - -@test "Check Ruby tools and versions" { - [[ $SKIP == 1 ]] && skip - - ### Setup ### - make start - - run _healthcheck_wait - unset output - - ### Tests ### - - # rvm - run docker exec -u docker "$NAME" bash -lc 'rvm --version 2>&1 | grep "${RVM_VERSION_INSTALL}"' - [[ ${status} == 0 ]] - unset output - - # ruby - #run docker exec -u docker "$NAME" bash -lc 'ruby --version | grep "${RUBY_VERSION_INSTALL}"' - # Default Ruby version in Debian 11 = 2.7.x - run docker exec -u docker "$NAME" bash -lc 'ruby --version | grep "ruby 2.7"' - [[ ${status} == 0 ]] - unset output - - ### Cleanup ### - make clean -} - -@test "Check Python tools and versions" { - [[ $SKIP == 1 ]] && skip - - ### Setup ### - make start - - run _healthcheck_wait - unset output - - ### Tests ### - - # pyenv - run docker exec -u docker "$NAME" bash -lc 'pyenv --version 2>&1 | grep "${PYENV_VERSION_INSTALL}"' + # Stock Ruby version in Debian 12 is 3.1.x + run docker exec -u docker "$NAME" bash -lc 'ruby --version | grep "ruby 3.1"' [[ ${status} == 0 ]] unset output - # pyenv - run docker exec -u docker "$NAME" bash -lc 'python --version 2>&1 | grep "${PYTHON_VERSION_INSTALL}"' + # Stock Python version in Debian 12 is 3.11.x + run docker exec -u docker "$NAME" bash -lc 'python3 --version 2>&1 | grep "Python 3.11"' [[ ${status} == 0 ]] unset output - ### Cleanup ### - make clean -} - -@test "Check misc tools and versions" { - [[ $SKIP == 1 ]] && skip - - ### Setup ### - make start - - run _healthcheck_wait - unset output - - ### Tests ### - # Check msmtp run docker exec -u docker "$NAME" which msmtp echo "$output" | grep "/usr/bin/msmtp" From a9d31f38e3593dcbadfc27577f32cd125e872de4 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 24 Nov 2023 19:45:15 +0100 Subject: [PATCH 08/23] PHP 8.3.0 (RC6) - PHP imagick extension not yet supported --- .github/workflows/default.yaml | 17 + 8.3/.dockerignore | 4 + 8.3/Dockerfile | 441 ++++++++++++++++++ 8.3/Makefile | 76 +++ 8.3/config/.ssh/config | 5 + 8.3/config/.ssh/id_rsa.tmpl | 1 + 8.3/config/.terminus/config.yml | 2 + 8.3/config/code-server/User/settings.json | 37 ++ 8.3/config/code-server/config.yaml.tmpl | 9 + 8.3/config/php/opcache.ini | 3 + 8.3/config/php/xdebug.ini | 12 + 8.3/config/php/xhprof.ini | 2 + 8.3/config/php/zz-php-fpm.conf | 19 + 8.3/config/php/zz-php.ini | 16 + .../supervisord-code-server.conf.tmpl | 6 + 8.3/config/supervisor/supervisord-crond.conf | 5 + .../supervisor/supervisord-php-fpm.conf | 4 + 8.3/config/supervisor/supervisord-sshd.conf | 4 + 8.3/config/supervisor/supervisord.conf | 6 + 8.3/healthcheck.sh | 16 + 8.3/ping-web.sh | 11 + 8.3/startup.sh | 238 ++++++++++ 8.3/tests/essential-binaries.sh | 82 ++++ 8.3/tests/php-modules.sh | 147 ++++++ 24 files changed, 1163 insertions(+) create mode 100644 8.3/.dockerignore create mode 100644 8.3/Dockerfile create mode 100644 8.3/Makefile create mode 100644 8.3/config/.ssh/config create mode 100644 8.3/config/.ssh/id_rsa.tmpl create mode 100644 8.3/config/.terminus/config.yml create mode 100644 8.3/config/code-server/User/settings.json create mode 100644 8.3/config/code-server/config.yaml.tmpl create mode 100644 8.3/config/php/opcache.ini create mode 100644 8.3/config/php/xdebug.ini create mode 100644 8.3/config/php/xhprof.ini create mode 100644 8.3/config/php/zz-php-fpm.conf create mode 100644 8.3/config/php/zz-php.ini create mode 100644 8.3/config/supervisor/supervisord-code-server.conf.tmpl create mode 100644 8.3/config/supervisor/supervisord-crond.conf create mode 100644 8.3/config/supervisor/supervisord-php-fpm.conf create mode 100644 8.3/config/supervisor/supervisord-sshd.conf create mode 100644 8.3/config/supervisor/supervisord.conf create mode 100755 8.3/healthcheck.sh create mode 100755 8.3/ping-web.sh create mode 100755 8.3/startup.sh create mode 100755 8.3/tests/essential-binaries.sh create mode 100755 8.3/tests/php-modules.sh diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index 1335d19a..8a2776a1 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -39,6 +39,10 @@ jobs: platform: linux/amd64 arch: amd64 version: '8.2' + - + platform: linux/amd64 + arch: amd64 + version: '8.3' - platform: linux/arm64 arch: arm64 @@ -47,6 +51,10 @@ jobs: platform: linux/arm64 arch: arm64 version: '8.2' + - + platform: linux/arm64 + arch: arm64 + version: '8.3' env: ARCH: ${{ matrix.arch }} @@ -120,6 +128,10 @@ jobs: platform: linux/amd64 arch: amd64 version: '8.2' + - + platform: linux/amd64 + arch: amd64 + version: '8.3' - platform: linux/arm64 arch: arm64 @@ -128,6 +140,10 @@ jobs: platform: linux/arm64 arch: arm64 version: '8.2' + - + platform: linux/arm64 + arch: arm64 + version: '8.3' env: ARCH: ${{ matrix.arch }} @@ -203,6 +219,7 @@ jobs: version: - '8.1' - '8.2' + - '8.3' env: VERSION_PREFIX: php diff --git a/8.3/.dockerignore b/8.3/.dockerignore new file mode 100644 index 00000000..0123c988 --- /dev/null +++ b/8.3/.dockerignore @@ -0,0 +1,4 @@ +tests +.dockerignore +Dockerfile +Makefile diff --git a/8.3/Dockerfile b/8.3/Dockerfile new file mode 100644 index 00000000..62c0554c --- /dev/null +++ b/8.3/Dockerfile @@ -0,0 +1,441 @@ +FROM php:8.3.0RC6-fpm-bookworm as cli + +ARG TARGETARCH +ARG DEBIAN_FRONTEND=noninteractive +ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 + +# Prevent services autoload (http://jpetazzo.github.io/2013/10/06/policy-rc-d-do-not-start-services-automatically/) +RUN set -xe; \ + echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d + +# Install basic packages +RUN set -xe; \ + apt-get update >/dev/null; \ + apt-get -y --no-install-recommends install >/dev/null \ + apt-transport-https \ + # ca-certificates and curl come from upstream + #ca-certificates \ + #curl \ + gnupg \ + locales \ + wget \ + ;\ + # Cleanup + apt-get clean; rm -rf /var/lib/apt/lists/* + +# Set en_US.UTF-8 as the default locale +RUN set -xe; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +ENV LC_ALL en_US.utf8 + +# Additional packages +RUN set -xe; \ + # Create man direcotries, otherwise some packages may not install (e.g. postgresql-client) + # This should be a temporary workaround until fixed upstream: https://github.com/debuerreotype/debuerreotype/issues/10 + mkdir -p /usr/share/man/man1 /usr/share/man/man7; \ + apt-get update >/dev/null; \ + apt-get -y --no-install-recommends install >/dev/null \ + cron \ + dnsutils \ + git \ + git-lfs \ + ghostscript \ + # html2text binary - used for self-testing (php-fpm) + html2text \ + imagemagick \ + iputils-ping \ + less \ + # cgi-fcgi binary - used for self-testing (php-fpm) + libfcgi-bin \ + mc \ + msmtp \ + # Debian ships with MariaDB instead of MySQL + mariadb-client \ + nano \ + openssh-client \ + openssh-server \ + postgresql-client \ + procps \ + pv \ + rsync \ + sudo \ + supervisor \ + unzip \ + webp \ + zip \ + ;\ + # Cleanup + apt-get clean; rm -rf /var/lib/apt/lists/* + +RUN set -xe; \ + # Create a regular user/group "docker" (uid = 1000, gid = 1000 ) + useradd -m -s /bin/bash -u 1000 -U -p docker docker; \ + # Give the docker user sudo access + usermod -a -G sudo docker; \ + echo 'docker ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# gosu v1.14+ discorages using it as a non-root user (https://github.com/tianon/gosu/issues/11), which we rely on here. +# See https://github.com/tianon/gosu/pull/89/commits/8afd3dec5fb4fe0356e4fb5d358fe235f7311181 +# We'll stick with v1.13 for the time being. +# TODO: Replace gosu with sudo/su in startup.sh +ENV \ + GOSU_VERSION=1.13 \ + GOMPLATE_VERSION=3.11.3 +RUN set -xe; \ + # Install gosu and give access to the docker user primary group to use it. + # gosu is used instead of sudo to start the main container process (pid 1) in a docker friendly way. + # https://github.com/tianon/gosu + curl -fsSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${TARGETARCH} -o /usr/local/bin/gosu; \ + chown root:$(id -gn docker) /usr/local/bin/gosu; \ + chmod +sx /usr/local/bin/gosu; \ + # gomplate (to process configuration templates in startup.sh) + curl -fsSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-${TARGETARCH} -o /usr/local/bin/gomplate; \ + chmod +x /usr/local/bin/gomplate + +# Configure sshd (for use PHPStorm's remote interpreters and tools integrations) +# http://docs.docker.com/examples/running_ssh_service/ +RUN set -xe; \ + mkdir /var/run/sshd; \ + echo 'docker:docker' | chpasswd; \ + sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config; \ + # SSH login fix. Otherwise user is kicked off after login + sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd; \ + echo "export VISIBLE=now" >> /etc/profile +ENV NOTVISIBLE "in users profile" + +# PHP +RUN set -xe; \ + # Note: essential build tools (g++, gcc, make, etc) are included upstream as persistent packages. + buildDeps=" \ + libc-client2007e-dev \ + libfreetype6-dev \ + libgpgme11-dev \ + libicu-dev \ + libjpeg62-turbo-dev \ + libkrb5-dev \ + libldap2-dev \ + libmagickcore-dev \ + libmagickwand-dev \ + libmemcached-dev \ + libmhash-dev \ + libpng-dev \ + libpq-dev \ + libwebp-dev \ + libssh2-1-dev \ + libxpm-dev \ + libxslt1-dev \ + libzip-dev \ + unixodbc-dev \ + "; \ + apt-get update >/dev/null; \ + apt-get -y --no-install-recommends install >/dev/null \ + $buildDeps \ + libc-client2007e \ + libfreetype6 \ + libgpgme11 \ + libicu72 \ + libjpeg62-turbo \ + libldap-2.5-0 \ + libmagickcore-6.q16-6-extra \ + libmagickwand-6.q16-6 \ + libmemcached11 \ + libmemcachedutil2 \ + libmhash2 \ + libpng16-16 \ + libpq5 \ + libssh2-1 \ + libxpm4 \ + libxslt1.1 \ + libzip4 \ + ;\ + docker-php-ext-configure >/dev/null gd \ + --with-freetype \ + --with-jpeg \ + --with-webp \ + --with-xpm; \ + PHP_OPENSSL=yes docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ + # Using $(uname -m) (returns x86_64 / aarch64) vs ${TARGETARCH} (returns amd64 / arm64) + docker-php-ext-configure >/dev/null ldap --with-libdir=lib/$(uname -m)-linux-gnu/; \ + docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ + docker-php-ext-configure >/dev/null zip; \ + \ + docker-php-ext-install >/dev/null -j$(nproc) \ + bcmath \ + bz2 \ + calendar\ + exif \ + gd \ + gettext \ + imap \ + intl \ + ldap \ + mysqli \ + opcache \ + pcntl \ + pdo_mysql \ + pdo_pgsql \ + pgsql \ + soap \ + sockets \ + xsl \ + zip \ + sysvsem \ + ;\ + pecl update-channels; \ + pecl install >/dev/null /dev/null; \ + apt-get clean; rm -rf /var/lib/apt/lists/* + +# MSSQL PHP client +RUN set -xe; \ + # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv + curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ + # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). + #curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + \ + buildDeps=" \ + unixodbc-dev \ + "; \ + apt-get update >/dev/null; \ + # Necessary for msodbcsql18 (MSSQL) + ACCEPT_EULA=Y \ + apt-get -y --no-install-recommends install >/dev/null \ + $buildDeps \ + msodbcsql18 \ + ;\ + pecl update-channels; \ + pecl install >/dev/null /dev/null; \ + apt-get clean; rm -rf /var/lib/apt/lists/* + +# PHP tools (installed globally) +ENV \ + COMPOSER_DEFAULT_VERSION=2 \ + COMPOSER_VERSION=1.10.27 \ + COMPOSER2_VERSION=2.6.5 \ + DRUSH_VERSION=8.4.12 \ + DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ + WPCLI_VERSION=2.9.0 \ + PLATFORMSH_CLI_VERSION=4.10.4 \ + ACQUIA_CLI_VERSION=2.18.0 \ + TERMINUS_VERSION=3.2.2 \ + JQ_VERSION=1.7 \ + YQ_VERSION=4.35.2 +RUN set -xe; \ + # Composer 1.x + curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer1; \ + # Composer 2.x + curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER2_VERSION}/composer.phar" -o /usr/local/bin/composer2; \ + # Drush 8 (global fallback) + curl -fsSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush8; \ + # Drupal Console Launcher + curl -fsSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_LAUNCHER_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ + # Wordpress CLI + curl -fsSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ + # Platform.sh CLI + curl -fsSL "https://github.com/platformsh/legacy-cli/releases/download/v${PLATFORMSH_CLI_VERSION}/platform.phar" -o /usr/local/bin/platform; \ + # Acquia CLI + curl -fsSL "https://github.com/acquia/cli/releases/download/${ACQUIA_CLI_VERSION}/acli.phar" -o /usr/local/bin/acli; \ + # Pantheon Terminus + curl -fsSL "https://github.com/pantheon-systems/terminus/releases/download/${TERMINUS_VERSION}/terminus.phar" -o /usr/local/bin/terminus; \ + # jq + curl -fsSL "https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux-${TARGETARCH}" -o /usr/local/bin/jq; \ + # yq + curl -fsSL "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${TARGETARCH}" -o /usr/local/bin/yq; \ + # Set Default Composer Version + ln -s /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} /usr/local/bin/composer; \ + # Make all downloaded binaries executable in one shot + (cd /usr/local/bin && chmod +x composer1 composer2 drush8 drupal wp platform acli terminus jq yq); + +# Install Python 3 + pip from Debian repos +RUN set -xe; \ + apt-get update >/dev/null; \ + apt-get -y --no-install-recommends install >/dev/null \ + python3 \ + python3-pip \ + ;\ + # Cleanup + apt-get clean; rm -rf /var/lib/apt/lists/* + +# Install Ruby from Debian repos +RUN set -xe; \ + apt-get update >/dev/null; \ + apt-get -y --no-install-recommends install >/dev/null \ + ruby-full \ + ;\ + # Cleanup + apt-get clean; rm -rf /var/lib/apt/lists/* + +# All further RUN commands will run as the "docker" user +USER docker +SHELL ["/bin/bash", "-c"] + +# Don't use -x here, as the output may be excessive +RUN set -e; \ + \ + # Composer based dependencies + # Add composer bin project level and global directories to PATH + # Project level comes first and thus takes precedence over the global one + echo -e "\n"'export PATH="$PATH:${PROJECT_ROOT:-/var/www}/vendor/bin"' >> $HOME/.profile; \ + echo -e "\n"'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ + # Reload updated PATH from profile to make composer/etc. visible below + . $HOME/.profile; \ + # Drupal Coder & WP Coding Standards w/ a matching version of PHP_CodeSniffer + # Set allow-plugins. See https://getcomposer.org/allow-plugins + composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true; \ + composer global require drupal/coder wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp; \ + # Don't fix the indentation or installed_paths will not be set correctly + phpcs --config-set installed_paths \ +$HOME/.composer/vendor/drupal/coder/coder_sniffer/,\ +$HOME/.composer/vendor/wp-coding-standards/wpcs/,\ +$HOME/.composer/vendor/phpcompatibility/php-compatibility/PHPCompatibility/,\ +$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP,\ +$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat; \ + # Cleanup + composer clear-cache + +# Node.js (installed as user) +ENV \ + NVM_VERSION=0.39.5 \ + NODE_VERSION=18.17.0 \ + YARN_VERSION=1.22.19 +# Don't use -x here, as the output may be excessive +RUN set -e; \ + # NVM and a defaut Node.js version + export PROFILE="$HOME/.profile"; \ + curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash >/dev/null; \ + # Reload profile to load nvm (needed by Yarn installation below) + . $HOME/.profile; \ + # Yarn + export YARN_PROFILE="$HOME/.profile"; \ + curl -fsSL https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION} >/dev/null + +## Ruby bundler +## Don't use -x here, as the output may be excessive +RUN set -e; \ + # Export ruby gem bin path + echo 'export PATH=$PATH:$(ruby -r rubygems -e "puts Gem.user_dir")/bin' >> $HOME/.profile; \ + . $HOME/.profile; \ + gem install --user-install bundler; \ + # Have bundler install gems in the current directory (./.bundle) by default + echo -e "\n"'export BUNDLE_PATH=.bundle' >> $HOME/.profile + +# Notify web container about started fin exec +RUN echo '(/opt/ping-web.sh &)' >> $HOME/.profile + +USER root +SHELL ["/bin/sh", "-c"] + +# Copy configs and scripts +COPY --chown=docker:docker config/.terminus /home/docker/.terminus +COPY --chown=docker:docker config/.ssh /home/docker/.ssh +COPY config/supervisor /etc/supervisor/conf.d +COPY startup.sh /opt/startup.sh +COPY healthcheck.sh /opt/healthcheck.sh +COPY ping-web.sh /opt/ping-web.sh +# PHP default settings, global overrides and fpm overrides +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" +COPY config/php/zz-php.ini /usr/local/etc/php/conf.d/zz-php.ini +COPY config/php/xdebug.ini /opt/docker-php-ext-xdebug.ini +COPY config/php/xhprof.ini /opt/docker-php-ext-xhprof.ini +COPY config/php/opcache.ini /opt/docker-php-ext-opcache.ini +COPY config/php/zz-php-fpm.conf /usr/local/etc/php-fpm.d/zz-php-fpm.conf + +ENV \ + # ssh-agent proxy socket (requires docksal/ssh-agent) + SSH_AUTH_SOCK=/.ssh-agent/proxy-socket \ + # Set TERM so text editors/etc. can be used + TERM=xterm \ + # Allow PROJECT_ROOT to be universally used in fin custom commands (inside and outside cli) + PROJECT_ROOT=/var/www \ + # Default values for HOST_UID and HOST_GUI to match the default Ubuntu user. These are used in startup.sh + HOST_UID=1000 \ + HOST_GID=1000 \ + # Delay in seconds between pings web from cli, while running fin exec. 0 - disabled + WEB_KEEPALIVE=0 \ + # xdebug disabled by default + XDEBUG_ENABLED=0 \ + XHPROF_ENABLED=0 \ + XHPROF_OUTPUT_DIR=/tmp/xhprof + +# TODO: [v3] remove and set these via docker-compose +EXPOSE 9000 +EXPOSE 22 +EXPOSE 3000 + +WORKDIR /var/www + +# Starter script +ENTRYPOINT ["/opt/startup.sh"] + +# By default, launch supervisord to keep the container running. +CMD ["supervisord"] + +# Health check script +HEALTHCHECK --interval=5s --timeout=1s --retries=12 CMD ["/opt/healthcheck.sh"] + + +# Visual Studio Code Server flavor +FROM cli as code-server + +# Run as docker, so we don't have to fix permissions +USER docker + +ARG HOME=/home/docker + +ENV \ + CODE_SERVER_VERSION=4.10.1 \ + VSCODE_GITLENS_VERSION=13.2.2 \ + VSCODE_XDEBUG_VERSION=1.32.0 \ + VSCODE_HOME="${HOME}/code-server" + +# Install code-server +RUN set -xe; \ + curl -fsSL "https://github.com/cdr/code-server/releases/download/v${CODE_SERVER_VERSION}/code-server_${CODE_SERVER_VERSION}_${TARGETARCH}.deb" -o /tmp/code-server_${TARGETARCH}.deb; \ + sudo dpkg -i /tmp/code-server_${TARGETARCH}.deb; \ + rm -rf /tmp/*.* + +# Settings +COPY --chown=docker:docker config/code-server ${VSCODE_HOME} + +# Install extensions +# Note: Have to use --user-data-dir with --install-extension instead of --config +RUN set -xe; \ + code-server --user-data-dir=${VSCODE_HOME} --install-extension eamodio.gitlens@${VSCODE_GITLENS_VERSION}; \ + code-server --user-data-dir=${VSCODE_HOME} --install-extension felixfbecker.php-debug@${VSCODE_XDEBUG_VERSION} + +# Switch back to root (IMPORTANT!) +USER root diff --git a/8.3/Makefile b/8.3/Makefile new file mode 100644 index 00000000..84dbc119 --- /dev/null +++ b/8.3/Makefile @@ -0,0 +1,76 @@ +-include ../tests/env_make +-include env_make + +IMAGE ?= docksal/cli +VERSION_PREFIX ?= php +VERSION ?= 8.3 +BUILD_IMAGE_TAG ?= $(IMAGE):$(VERSION_PREFIX)$(VERSION)-build +NAME = docksal-cli-$(VERSION)-$(GIT_SHA7) +CWD = $(shell pwd) + +# Improve write performance for /home/docker by turning it into a volume +VOLUMES = -v /home/docker + +.EXPORT_ALL_VARIABLES: + +.PHONY: build exec test push shell run start stop logs clean release + +default: build + +build: + docker build -t $(BUILD_IMAGE_TAG) . + +# See https://docs.docker.com/buildx/working-with-buildx/ +# See https://github.com/docker/buildx +buildx: + docker buildx build --tag $(BUILD_IMAGE_TAG) . +buildx-with-cache: + docker buildx build --cache-from=type=registry,ref=$(BUILD_IMAGE_TAG) --cache-to=type=inline --tag=$(BUILD_IMAGE_TAG) . + +test: + NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + +push: + docker push $(BUILD_IMAGE_TAG) + +run: clean + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) + +# Copy files into container instead of mounting from the host at runtime. +# This allows running tests on a remote docker instance. +start: clean + docker create --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) + docker cp ../tests/. $(NAME):/var/www/ + docker start $(NAME) + +# Only copy docroot (not config overrides) +start-bare: clean + docker create --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(BUILD_IMAGE_TAG) + docker cp ../tests/docroot/. $(NAME):/var/www/docroot/ + docker start $(NAME) + +# Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) +exec: + @docker exec -u docker $(NAME) bash -lc "$(CMD)" + +# Interactive docker exec +exec-it: + @docker exec -u docker -it $(NAME) bash -ilc "$(CMD)" + +shell: + @docker exec -u docker -it $(NAME) bash -il + +stop: + docker stop $(NAME) + +logs: + docker logs $(NAME) + +logs-follow: + docker logs -f $(NAME) + +clean: + docker rm -vf $(NAME) >/dev/null 2>&1 || true + +tags: + @../.github/scripts/docker-tags.sh diff --git a/8.3/config/.ssh/config b/8.3/config/.ssh/config new file mode 100644 index 00000000..74320faa --- /dev/null +++ b/8.3/config/.ssh/config @@ -0,0 +1,5 @@ +# Disable remote host key checking and warnings +Host * + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + LogLevel ERROR diff --git a/8.3/config/.ssh/id_rsa.tmpl b/8.3/config/.ssh/id_rsa.tmpl new file mode 100644 index 00000000..8c6c22f1 --- /dev/null +++ b/8.3/config/.ssh/id_rsa.tmpl @@ -0,0 +1 @@ +{{ getenv "SECRET_SSH_PRIVATE_KEY" | base64.Decode }} \ No newline at end of file diff --git a/8.3/config/.terminus/config.yml b/8.3/config/.terminus/config.yml new file mode 100644 index 00000000..c7e89515 --- /dev/null +++ b/8.3/config/.terminus/config.yml @@ -0,0 +1,2 @@ +hide_update_message: true +hide_git_mode_warning: true \ No newline at end of file diff --git a/8.3/config/code-server/User/settings.json b/8.3/config/code-server/User/settings.json new file mode 100644 index 00000000..1007d613 --- /dev/null +++ b/8.3/config/code-server/User/settings.json @@ -0,0 +1,37 @@ +{ + // XDebug Launch Configuration settings + "launch": { + "version": "0.2.0", + "configurations": [ + // Listener mode (recommended for most cases) + // Can be used to debug both: web and cli PHP sessions. + { + "name": "XDebug (listener)", + "type": "php", + "request": "launch", + "port": 9000 + }, + // Current script mode + // Note: IDE launches the script inside of the ide container and not the cli container. + { + "name": "XDebug (currently open script)", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "port": 9000 + } + ] + }, + // File associations + "files.associations": { + "*.inc": "php", + "*.module": "php", + "*.install": "php", + "*.theme": "php", + "*.tpl.php": "php", + "*.test": "php", + "*.php": "php" + }, + "workbench.colorTheme": "Default Dark+" +} diff --git a/8.3/config/code-server/config.yaml.tmpl b/8.3/config/code-server/config.yaml.tmpl new file mode 100644 index 00000000..495d812e --- /dev/null +++ b/8.3/config/code-server/config.yaml.tmpl @@ -0,0 +1,9 @@ +user-data-dir: {{ getenv "VSCODE_HOME" }} +bind-addr: 0.0.0.0:8080 +cert: false +{{ if (getenv "IDE_PASSWORD") }} +auth: password +password: {{ getenv "IDE_PASSWORD" }} +{{ else }} +auth: none +{{ end }} diff --git a/8.3/config/php/opcache.ini b/8.3/config/php/opcache.ini new file mode 100644 index 00000000..bbc72325 --- /dev/null +++ b/8.3/config/php/opcache.ini @@ -0,0 +1,3 @@ +; Extention settings +[opcache] +opcache.preload=/var/www/.docksal/etc/php/preload.php diff --git a/8.3/config/php/xdebug.ini b/8.3/config/php/xdebug.ini new file mode 100644 index 00000000..90111271 --- /dev/null +++ b/8.3/config/php/xdebug.ini @@ -0,0 +1,12 @@ +[xdebug] +zend_extension=xdebug.so +; See https://xdebug.org/docs/all_settings#mode +xdebug.mode=debug +; xdebug.xdebug.client_host defaults to "localhost", which works with VS Code Server web IDE running locally +; For debugging from a "remote" host, xdebug.xdebug.client_host is set to ${DOCKSAL_HOST_IP} at runtime +; xdebug.xdebug.client_port defaults to "9003" in Xdebug 3. We use 9000 instead for backward compatibility with Xdebug 2. +xdebug.client_port=9000 +; TODO: Why do we have to set this? +xdebug.idekey=xdebug_session +; Increase max_nesting_level to support complex Drupal pages (default is 100) +xdebug.max_nesting_level=256 diff --git a/8.3/config/php/xhprof.ini b/8.3/config/php/xhprof.ini new file mode 100644 index 00000000..6c2e4dc9 --- /dev/null +++ b/8.3/config/php/xhprof.ini @@ -0,0 +1,2 @@ +[xhprof] +extension="xhprof.so" diff --git a/8.3/config/php/zz-php-fpm.conf b/8.3/config/php/zz-php-fpm.conf new file mode 100644 index 00000000..d4fb5e22 --- /dev/null +++ b/8.3/config/php/zz-php-fpm.conf @@ -0,0 +1,19 @@ +; PHP-FPM settings + +[global] +; This pid file is used for Docker healthcheck +pid = /run/php-fpm.pid + +[www] +user = docker +catch_workers_output = yes +listen = 0.0.0.0:9000 +clear_env = no + +; PHP (FPM) settings +; See zz-php.ini for global (CLI and FPM) PHP settings +php_value[memory_limit] = 256M +php_value[max_execution_time] = 300 +php_value[upload_max_filesize] = 500M +php_value[post_max_size] = 500M +php_value[max_input_vars] = 2000 diff --git a/8.3/config/php/zz-php.ini b/8.3/config/php/zz-php.ini new file mode 100644 index 00000000..c7ece851 --- /dev/null +++ b/8.3/config/php/zz-php.ini @@ -0,0 +1,16 @@ +; PHP global (CLI and FPM) settings +; To override settings for FPM use zz-php-fpm.conf +[php] +memory_limit = -1 +max_execution_time = 600 +date.timezone = UTC +display_errors = On +display_startup_errors = On + +[mail] +; Enable Mailhog integration by default +sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --from=docker@cli' + +; Extention settings +[opcache] +opcache.memory_consumption = 128 diff --git a/8.3/config/supervisor/supervisord-code-server.conf.tmpl b/8.3/config/supervisor/supervisord-code-server.conf.tmpl new file mode 100644 index 00000000..7016f1a7 --- /dev/null +++ b/8.3/config/supervisor/supervisord-code-server.conf.tmpl @@ -0,0 +1,6 @@ +# VS Code Server web IDE +[program:code-server] +# Using bash -lc here to load docker user profile (necessary for nvn/node to initialize) +command = gosu docker bash -lc '/usr/bin/code-server --config=${VSCODE_HOME}/config.yaml /var/www' +stdout_logfile = /var/log/supervisor/code-server-stdout +stderr_logfile = /var/log/supervisor/code-server-stderr diff --git a/8.3/config/supervisor/supervisord-crond.conf b/8.3/config/supervisor/supervisord-crond.conf new file mode 100644 index 00000000..33dbd8e1 --- /dev/null +++ b/8.3/config/supervisor/supervisord-crond.conf @@ -0,0 +1,5 @@ +[program:cron] +# Cron will only log to syslog and nothing else... +command = /usr/sbin/cron -f +stdout_logfile = /var/log/supervisor/cron-stdout +stderr_logfile = /var/log/supervisor/cron-stderr diff --git a/8.3/config/supervisor/supervisord-php-fpm.conf b/8.3/config/supervisor/supervisord-php-fpm.conf new file mode 100644 index 00000000..b4420872 --- /dev/null +++ b/8.3/config/supervisor/supervisord-php-fpm.conf @@ -0,0 +1,4 @@ +[program:php-fpm] +command = /usr/local/sbin/php-fpm +stdout_logfile = /var/log/supervisor/php-fpm-stdout +stderr_logfile = /var/log/supervisor/php-fpm-stderr diff --git a/8.3/config/supervisor/supervisord-sshd.conf b/8.3/config/supervisor/supervisord-sshd.conf new file mode 100644 index 00000000..de159108 --- /dev/null +++ b/8.3/config/supervisor/supervisord-sshd.conf @@ -0,0 +1,4 @@ +[program:sshd] +command = /usr/sbin/sshd -D +stdout_logfile = /var/log/supervisor/sshd-stdout +stderr_logfile = /var/log/supervisor/sshd-stderr diff --git a/8.3/config/supervisor/supervisord.conf b/8.3/config/supervisor/supervisord.conf new file mode 100644 index 00000000..32c7217a --- /dev/null +++ b/8.3/config/supervisor/supervisord.conf @@ -0,0 +1,6 @@ +[supervisord] +nodaemon = true +# debug prints output from all services to stdout/stderr. +# This way logs can be reviewed with docker logs. +# Additionalluy, logs from specific services are forwarded to individual files on disk. +loglevel = debug diff --git a/8.3/healthcheck.sh b/8.3/healthcheck.sh new file mode 100755 index 00000000..b4ab59d0 --- /dev/null +++ b/8.3/healthcheck.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Initialization phase in startup.sh is complete +[[ -f /var/run/cli ]] || exit 1 + +# supervisor services are running +if [[ -f /run/supervisord.pid ]]; then + if [[ "${IDE_ENABLED}" == "1" ]]; then + # IDE mode + ps aux | grep code-server >/dev/null || exit 1 + else + # php-fpm/cli mode + [[ -f /run/php-fpm.pid ]] || exit 1 + [[ -f /run/sshd.pid ]] || exit 1 + fi +fi diff --git a/8.3/ping-web.sh b/8.3/ping-web.sh new file mode 100755 index 00000000..6a5ba7b8 --- /dev/null +++ b/8.3/ping-web.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Notify web container about started fin exec +if [[ "${WEB_KEEPALIVE}" != "0" ]] && [[ "${VIRTUAL_HOST}" != "" ]] +then + while true + do + curl -s -m 1 ${VIRTUAL_HOST}/exec_in_progress_inside_cli >/dev/null 2>&1 + sleep ${WEB_KEEPALIVE} + done +fi diff --git a/8.3/startup.sh b/8.3/startup.sh new file mode 100755 index 00000000..7861a81d --- /dev/null +++ b/8.3/startup.sh @@ -0,0 +1,238 @@ +#!/bin/bash + +# This script is running as root by default. +# Switching to the docker user can be done via "gosu docker ". + +HOME_DIR='/home/docker' + +DEBUG=${DEBUG:-0} +# Turn debugging ON when cli is started in the service mode +[[ "$1" == "supervisord" ]] && DEBUG=1 +echo-debug () +{ + [[ "$DEBUG" != 0 ]] && echo "$(date +"%F %H:%M:%S") | $@" +} + +uid_gid_reset () +{ + if [[ "$HOST_UID" != "$(id -u docker)" ]] || [[ "$HOST_GID" != "$(id -g docker)" ]]; then + echo-debug "Updating docker user uid/gid to $HOST_UID/$HOST_GID to match the host user uid/gid..." + usermod -u "$HOST_UID" -o docker + groupmod -g "$HOST_GID" -o "$(id -gn docker)" + fi +} + +xdebug_enable () +{ + echo-debug "Enabling xdebug..." + ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ +} + +xhprof_enable () +{ + echo-debug "Enabling xhprof..." + cp /opt/docker-php-ext-xhprof.ini /usr/local/etc/php/conf.d/ + # Output directory to the ini file + echo "xhprof.output_dir = ${XHPROF_OUTPUT_DIR}" >> /usr/local/etc/php/conf.d/docker-php-ext-xhprof.ini + # Try to create directory if it doesn't exist + mkdir ${XHPROF_OUTPUT_DIR} || true + # Change owner of directory + chown docker:docker ${XHPROF_OUTPUT_DIR} +} + +opcache_preload_enable() +{ + echo-debug "Enabling opcache preload..." + ln -s /opt/docker-php-ext-opcache.ini /usr/local/etc/php/conf.d/ +} + +ide_mode_enable () +{ + echo-debug "Enabling web IDE..." + # Enabled only code-server service (disabled all other services) + # TODO: split IDE/cli and php-fpm entirely + rm -f /etc/supervisor/conf.d/supervisord-*.conf + render_tmpl "/etc/supervisor/conf.d/supervisord-code-server.conf" + render_tmpl "${VSCODE_HOME}/config.yaml" +} + +# Creates symlinks to project level overrides if they exist +php_settings () +{ + php_ini=/var/www/.docksal/etc/php/php.ini + if [[ -f ${php_ini} ]]; then + echo-debug "Found project level overrides for PHP. Including:" + echo-debug "${php_ini}" + ln -s /var/www/.docksal/etc/php/php.ini /usr/local/etc/php/conf.d/zzz-php.ini + fi + + php_fpm_conf=/var/www/.docksal/etc/php/php-fpm.conf + if [[ -f ${php_fpm_conf} ]]; then + echo-debug "Found project level overrides for PHP-FPM. Including:" + echo-debug "${php_fpm_conf}" + ln -s ${php_fpm_conf} /usr/local/etc/php-fpm.d/zzz-php-fpm.conf + fi +} + +add_ssh_key () +{ + echo-debug "Adding a private SSH key from SECRET_SSH_PRIVATE_KEY..." + render_tmpl "$HOME_DIR/.ssh/id_rsa" + chmod 0600 "$HOME_DIR/.ssh/id_rsa" +} + +# Helper function to render configs from go templates using gomplate +render_tmpl () +{ + local file="${1}" + local tmpl="${1}.tmpl" + + if [[ -f "${tmpl}" ]]; then + echo-debug "Rendering template: ${tmpl}..." + # gomplate started throwing an empty line into stderr in v3.7.0, so we have to mute it below + gomplate --file "${tmpl}" --out "${file}" &>/dev/null + else + echo-debug "Error: Template file not found: ${tmpl}" + return 1 + fi +} + +# Helper function to loop through all environment variables prefixed with SECRET_ and +# convert to the equivalent variable without SECRET. +# Example: SECRET_TERMINUS_TOKEN => TERMINUS_TOKEN. +convert_secrets () +{ + eval 'secrets=(${!SECRET_@})' + for secret_key in "${secrets[@]}"; do + key=${secret_key#SECRET_} + secret_value=${!secret_key} + + # Write new variables to /etc/profile.d/secrets.sh to make them available for all users/sessions + echo "export ${key}=\"${secret_value}\"" | tee -a "/etc/profile.d/secrets.sh" >/dev/null + + # Also export new variables here + # This makes them available in the server/php-fpm environment + eval "export ${key}=${secret_value}" + done +} + +# Pantheon (terminus) login +terminus_login () +{ + echo-debug "Authenticating with Pantheon..." + # This has to be done using the docker user via su to load the user environment + # Note: Using 'su -l' to initiate a login session and have .profile sourced for the docker user + local command="terminus auth:login --no-interaction --machine-token='${TERMINUS_TOKEN}'" + local output=$(su -l docker -c "${command}") + if [[ $? != 0 ]]; then + echo-debug "ERROR: Pantheon authentication failed." + echo + echo "$output" + echo + fi +} + +# Acquia CLI login +acli_login () +{ + echo-debug "Authenticating with Acquia..." + # This has to be done using the docker user via su to load the user environment + # Note: Using 'su -l' to initiate a login session and have .profile sourced for the docker user + local command="acli auth:login --key='${ACQUIA_CLI_KEY}' --secret='${ACQUIA_CLI_SECRET}' --no-interaction" + local output=$(su -l docker -c "${command}" 2>&1) + if [[ $? != 0 ]]; then + echo-debug "ERROR: Acquia authentication failed." + echo + echo "$output" + echo + fi +} + +# Git settings +git_settings () +{ + # These must be run as the docker user + echo-debug "Configuring git..." + # Set default git settings if none have been passed + # See https://github.com/docksal/service-cli/issues/124 + gosu docker git config --global user.email "${GIT_USER_EMAIL:-cli@docksal.io}" + gosu docker git config --global user.name "${GIT_USER_NAME:-Docksal CLI}" +} + +# Inject a private SSH key if provided +[[ "$SECRET_SSH_PRIVATE_KEY" != "" ]] && add_ssh_key + +# Set Composer Version +[[ "${COMPOSER_DEFAULT_VERSION}" != "" ]] && [[ -f /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} ]] && ln -sf /usr/local/bin/composer${COMPOSER_DEFAULT_VERSION} /usr/local/bin/composer + +# Convert all Environment Variables Prefixed with SECRET_ +convert_secrets + +# Docker user uid/gid mapping to the host user uid/gid +[[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset + +# Enable xdebug +[[ "$XDEBUG_ENABLED" != "" ]] && [[ "$XDEBUG_ENABLED" != "0" ]] && xdebug_enable + +# Enable xdebug +[[ "$XHPROF_ENABLED" != "" ]] && [[ "$XHPROF_ENABLED" != "0" ]] && xhprof_enable + +# Enable opcache preload +[[ -f "/var/www/.docksal/etc/php/preload.php" ]] && opcache_preload_enable + +# Enable web IDE +[[ "$IDE_ENABLED" != "" ]] && [[ "$IDE_ENABLED" != "0" ]] && ide_mode_enable + +# Include project level PHP settings if found +php_settings + +# Make sure permissions are correct (after uid/gid change and COPY operations in Dockerfile) +# To not bloat the image size, permissions on the home folder are reset at runtime. +echo-debug "Resetting permissions on $HOME_DIR and /var/www..." +chown "${HOST_UID:-1000}:${HOST_GID:-1000}" -R "$HOME_DIR" +# Docker resets the project root folder permissions to 0:0 when cli is recreated (e.g. an env variable updated). +# We apply a fix/workaround for this at startup (non-recursive). +chown "${HOST_UID:-1000}:${HOST_GID:-1000}" /var/www + +# These have to happen after the home directory permissions are reset, +# otherwise the docker user may not have write access to /home/docker, where the auth session data is stored. +# Automatically authenticate with Pantheon if Terminus token is present +[[ "$TERMINUS_TOKEN" != "" ]] && terminus_login + +# Authenticate to Acquia CLI +[[ "$ACQUIA_CLI_KEY" != "" ]] && [[ "$ACQUIA_CLI_SECRET" != "" ]] && acli_login + +# If crontab file is found within project add contents to user crontab file. +if [[ -f ${PROJECT_ROOT}/.docksal/services/cli/crontab ]]; then + echo-debug "Loading crontab..." + cat ${PROJECT_ROOT}/.docksal/services/cli/crontab | crontab -u docker - +fi + +# Apply git settings +[[ "$GIT_USER_EMAIL" != "" ]] && [[ "$GIT_USER_NAME" != "" ]] && git_settings + +# Initialization steps completed. Create a pid file to mark the container as healthy +echo-debug "Preliminary initialization completed." +touch /var/run/cli + +# Execute a custom startup script if present +if [[ -x ${PROJECT_ROOT}/.docksal/services/cli/startup.sh ]]; then + echo-debug "Running custom startup script..." + # TODO: should we source the script instead? + su -l docker -c "${PROJECT_ROOT}/.docksal/services/cli/startup.sh" + if [[ $? == 0 ]]; then + echo-debug "Custom startup script executed successfully." + else + echo-debug "ERROR: Custom startup script execution failed." + fi +fi + +# Execute passed CMD arguments +echo-debug "Passing execution to: $*" +# Service mode (run as root) +if [[ "$1" == "supervisord" ]]; then + exec gosu root supervisord -c /etc/supervisor/supervisord.conf +# Command mode (run as docker user) +else + exec gosu docker "$@" +fi diff --git a/8.3/tests/essential-binaries.sh b/8.3/tests/essential-binaries.sh new file mode 100755 index 00000000..480d8b91 --- /dev/null +++ b/8.3/tests/essential-binaries.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +binaries_amd64=\ +'bundler +cat +convert +curl +dig +g++ +ghostscript +git +git-lfs +gcc +jq +html2text +less +make +mc +more +mysql +nano +node +nvm +nslookup +php +ping +pip +psql +pv +python3 +rsync +ruby +sudo +unzip +wget +yq +zip' + +binaries_arm64=\ +'bundler +cat +convert +curl +dig +g++ +ghostscript +git +git-lfs +gcc +jq +html2text +less +make +mc +more +mysql +nano +node +nvm +nslookup +php +ping +psql +pv +python3 +rsync +ruby +sudo +unzip +wget +yq +zip' + +# Use the docker reported architecture and not the hosts (uname -m). +# docker arch may not be the same as hosts's arch (e.g., when using a remote docker instance). +case "$(docker info -f '{{ .Architecture }}')" in + x86_64) echo "${binaries_amd64}" ;; + amd64) echo "${binaries_amd64}" ;; + aarch64) echo "${binaries_arm64}" ;; + arm64) echo "${binaries_arm64}" ;; + * ) false;; +esac diff --git a/8.3/tests/php-modules.sh b/8.3/tests/php-modules.sh new file mode 100755 index 00000000..16b56c22 --- /dev/null +++ b/8.3/tests/php-modules.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash + +php_modules_amd64=\ +'[PHP Modules] +apcu +bcmath +bz2 +calendar +Core +ctype +curl +date +dom +exif +fileinfo +filter +ftp +gd +gettext +gnupg +hash +iconv +imap +intl +json +ldap +libxml +mbstring +memcached +mysqli +mysqlnd +openssl +pcntl +pcre +PDO +pdo_mysql +pdo_pgsql +pdo_sqlite +pdo_sqlsrv +pgsql +Phar +posix +random +readline +redis +Reflection +session +SimpleXML +soap +sockets +sodium +SPL +sqlite3 +sqlsrv +ssh2 +standard +sysvsem +tokenizer +xml +xmlreader +xmlwriter +xsl +Zend OPcache +zip +zlib + +[Zend Modules] +Zend OPcache +' + +php_modules_arm64=\ +'[PHP Modules] +apcu +bcmath +bz2 +calendar +Core +ctype +curl +date +dom +exif +fileinfo +filter +ftp +gd +gettext +gnupg +hash +iconv +imap +intl +json +ldap +libxml +mbstring +memcached +mysqli +mysqlnd +openssl +pcntl +pcre +PDO +pdo_mysql +pdo_pgsql +pdo_sqlite +pdo_sqlsrv +pgsql +Phar +posix +random +readline +redis +Reflection +session +SimpleXML +soap +sockets +sodium +SPL +sqlite3 +sqlsrv +ssh2 +standard +sysvsem +tokenizer +xml +xmlreader +xmlwriter +xsl +Zend OPcache +zip +zlib + +[Zend Modules] +Zend OPcache +' + +# Use the docker reported architecture and not the hosts (uname -m). +# docker arch may not be the same as hosts's arch (e.g., when using a remote docker instance). +case "$(docker info -f '{{ .Architecture }}')" in + x86_64) echo "${php_modules_amd64}" ;; + amd64) echo "${php_modules_amd64}" ;; + aarch64) echo "${php_modules_arm64}" ;; + arm64) echo "${php_modules_arm64}" ;; + * ) false;; +esac From 1ab10aadeb338b8ea30683cbb2162bd345db1a55 Mon Sep 17 00:00:00 2001 From: Vladislav Shumkin Date: Fri, 9 Feb 2024 04:40:35 +0200 Subject: [PATCH 09/23] Update composer to v2.7.0 This fixes CVE-2024-24821 Reference: https://github.com/advisories/GHSA-7c6p-848j-wh5h --- 8.1/Dockerfile | 2 +- 8.2/Dockerfile | 2 +- 8.3/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index f2fe86f2..9beb1e37 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -242,7 +242,7 @@ RUN set -xe; \ ENV \ COMPOSER_DEFAULT_VERSION=2 \ COMPOSER_VERSION=1.10.27 \ - COMPOSER2_VERSION=2.6.5 \ + COMPOSER2_VERSION=2.7.0 \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 64929680..b1ebdf00 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -242,7 +242,7 @@ RUN set -xe; \ ENV \ COMPOSER_DEFAULT_VERSION=2 \ COMPOSER_VERSION=1.10.27 \ - COMPOSER2_VERSION=2.6.5 \ + COMPOSER2_VERSION=2.7.0 \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 62c0554c..01830383 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -245,7 +245,7 @@ RUN set -xe; \ ENV \ COMPOSER_DEFAULT_VERSION=2 \ COMPOSER_VERSION=1.10.27 \ - COMPOSER2_VERSION=2.6.5 \ + COMPOSER2_VERSION=2.7.0 \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ From f7e4b5dcd53c5c61b5b4a842789db40085b96512 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 15:05:56 +0100 Subject: [PATCH 10/23] Bump PHP versions - PHP 8.1.27 - PHP 8.2.15 - PHP 8.3.2 --- 8.1/Dockerfile | 2 +- 8.2/Dockerfile | 2 +- 8.3/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 9beb1e37..8ef63ee7 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1.25-fpm-bookworm as cli +FROM php:8.1.27-fpm-bookworm as cli ARG TARGETARCH ARG DEBIAN_FRONTEND=noninteractive diff --git a/8.2/Dockerfile b/8.2/Dockerfile index b1ebdf00..0fbe9804 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.2.12-fpm-bookworm as cli +FROM php:8.2.15-fpm-bookworm as cli ARG TARGETARCH ARG DEBIAN_FRONTEND=noninteractive diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 01830383..c6d76e56 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3.0RC6-fpm-bookworm as cli +FROM php:8.3.2-fpm-bookworm as cli ARG TARGETARCH ARG DEBIAN_FRONTEND=noninteractive From 8282e0ff10715de80b9322e0e2ce8d62f52f0d82 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 15:07:01 +0100 Subject: [PATCH 11/23] Switch from felixfbecker.php-debug to xdebug.php-debug for VS Code Server --- 8.1/Dockerfile | 2 +- 8.2/Dockerfile | 2 +- 8.3/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 8ef63ee7..5743aa5d 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -432,7 +432,7 @@ COPY --chown=docker:docker config/code-server ${VSCODE_HOME} # Note: Have to use --user-data-dir with --install-extension instead of --config RUN set -xe; \ code-server --user-data-dir=${VSCODE_HOME} --install-extension eamodio.gitlens@${VSCODE_GITLENS_VERSION}; \ - code-server --user-data-dir=${VSCODE_HOME} --install-extension felixfbecker.php-debug@${VSCODE_XDEBUG_VERSION} + code-server --user-data-dir=${VSCODE_HOME} --install-extension xdebug.php-debug@${VSCODE_XDEBUG_VERSION} # Switch back to root (IMPORTANT!) USER root diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 0fbe9804..c3024ce7 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -432,7 +432,7 @@ COPY --chown=docker:docker config/code-server ${VSCODE_HOME} # Note: Have to use --user-data-dir with --install-extension instead of --config RUN set -xe; \ code-server --user-data-dir=${VSCODE_HOME} --install-extension eamodio.gitlens@${VSCODE_GITLENS_VERSION}; \ - code-server --user-data-dir=${VSCODE_HOME} --install-extension felixfbecker.php-debug@${VSCODE_XDEBUG_VERSION} + code-server --user-data-dir=${VSCODE_HOME} --install-extension xdebug.php-debug@${VSCODE_XDEBUG_VERSION} # Switch back to root (IMPORTANT!) USER root diff --git a/8.3/Dockerfile b/8.3/Dockerfile index c6d76e56..2961adaa 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -435,7 +435,7 @@ COPY --chown=docker:docker config/code-server ${VSCODE_HOME} # Note: Have to use --user-data-dir with --install-extension instead of --config RUN set -xe; \ code-server --user-data-dir=${VSCODE_HOME} --install-extension eamodio.gitlens@${VSCODE_GITLENS_VERSION}; \ - code-server --user-data-dir=${VSCODE_HOME} --install-extension felixfbecker.php-debug@${VSCODE_XDEBUG_VERSION} + code-server --user-data-dir=${VSCODE_HOME} --install-extension xdebug.php-debug@${VSCODE_XDEBUG_VERSION} # Switch back to root (IMPORTANT!) USER root From ff8d4780d3d9e0b6ad2d8757c4961edbc44a2833 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 15:18:03 +0100 Subject: [PATCH 12/23] Bump VS Code Server versions - VS Code Server v4.20.1 - VS Code GitLens v14.7.0 - VS Code Xdebug v1.34.0 --- 8.1/Dockerfile | 6 +++--- 8.2/Dockerfile | 6 +++--- 8.3/Dockerfile | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 5743aa5d..9c33d8ff 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -414,9 +414,9 @@ USER docker ARG HOME=/home/docker ENV \ - CODE_SERVER_VERSION=4.10.1 \ - VSCODE_GITLENS_VERSION=13.2.2 \ - VSCODE_XDEBUG_VERSION=1.32.0 \ + CODE_SERVER_VERSION=4.20.1 \ + VSCODE_GITLENS_VERSION=14.7.0 \ + VSCODE_XDEBUG_VERSION=1.34.0 \ VSCODE_HOME="${HOME}/code-server" # Install code-server diff --git a/8.2/Dockerfile b/8.2/Dockerfile index c3024ce7..ec61a75d 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -414,9 +414,9 @@ USER docker ARG HOME=/home/docker ENV \ - CODE_SERVER_VERSION=4.10.1 \ - VSCODE_GITLENS_VERSION=13.2.2 \ - VSCODE_XDEBUG_VERSION=1.32.0 \ + CODE_SERVER_VERSION=4.20.1 \ + VSCODE_GITLENS_VERSION=14.7.0 \ + VSCODE_XDEBUG_VERSION=1.34.0 \ VSCODE_HOME="${HOME}/code-server" # Install code-server diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 2961adaa..e0ba8b4c 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -417,9 +417,9 @@ USER docker ARG HOME=/home/docker ENV \ - CODE_SERVER_VERSION=4.10.1 \ - VSCODE_GITLENS_VERSION=13.2.2 \ - VSCODE_XDEBUG_VERSION=1.32.0 \ + CODE_SERVER_VERSION=4.20.1 \ + VSCODE_GITLENS_VERSION=14.7.0 \ + VSCODE_XDEBUG_VERSION=1.34.0 \ VSCODE_HOME="${HOME}/code-server" # Install code-server From e6e226ca43364c36f46ae91a4dadeb19bd900cc7 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 15:18:28 +0100 Subject: [PATCH 13/23] Bump versions - Composer v2.6.6 - Platform.sh CLI v5.0.8 - Acquia CLI v2.22.1 - Terminus v3.3.3 - jq v1.7.1 - yq v4.40.5 - nvm v0.39.7 - Node.js v20.11.0 LTS - yarn v1.22.21 --- 8.1/Dockerfile | 16 ++++++++-------- 8.2/Dockerfile | 16 ++++++++-------- 8.3/Dockerfile | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 9c33d8ff..166c8880 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -246,11 +246,11 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - PLATFORMSH_CLI_VERSION=4.10.4 \ - ACQUIA_CLI_VERSION=2.18.0 \ - TERMINUS_VERSION=3.2.2 \ - JQ_VERSION=1.7 \ - YQ_VERSION=4.35.2 + PLATFORMSH_CLI_VERSION=5.0.8 \ + ACQUIA_CLI_VERSION=2.22.1 \ + TERMINUS_VERSION=3.3.3 \ + JQ_VERSION=1.7.1 \ + YQ_VERSION=4.40.5 RUN set -xe; \ # Composer 1.x curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer1; \ @@ -326,9 +326,9 @@ $HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibil # Node.js (installed as user) ENV \ - NVM_VERSION=0.39.5 \ - NODE_VERSION=18.17.0 \ - YARN_VERSION=1.22.19 + NVM_VERSION=0.39.7 \ + NODE_VERSION=20.11.0 \ + YARN_VERSION=1.22.21 # Don't use -x here, as the output may be excessive RUN set -e; \ # NVM and a defaut Node.js version diff --git a/8.2/Dockerfile b/8.2/Dockerfile index ec61a75d..b67094b0 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -246,11 +246,11 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - PLATFORMSH_CLI_VERSION=4.10.4 \ - ACQUIA_CLI_VERSION=2.18.0 \ - TERMINUS_VERSION=3.2.2 \ - JQ_VERSION=1.7 \ - YQ_VERSION=4.35.2 + PLATFORMSH_CLI_VERSION=5.0.8 \ + ACQUIA_CLI_VERSION=2.22.1 \ + TERMINUS_VERSION=3.3.3 \ + JQ_VERSION=1.7.1 \ + YQ_VERSION=4.40.5 RUN set -xe; \ # Composer 1.x curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer1; \ @@ -326,9 +326,9 @@ $HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibil # Node.js (installed as user) ENV \ - NVM_VERSION=0.39.5 \ - NODE_VERSION=18.17.0 \ - YARN_VERSION=1.22.19 + NVM_VERSION=0.39.7 \ + NODE_VERSION=20.11.0 \ + YARN_VERSION=1.22.21 # Don't use -x here, as the output may be excessive RUN set -e; \ # NVM and a defaut Node.js version diff --git a/8.3/Dockerfile b/8.3/Dockerfile index e0ba8b4c..5c5091d9 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -249,11 +249,11 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - PLATFORMSH_CLI_VERSION=4.10.4 \ - ACQUIA_CLI_VERSION=2.18.0 \ - TERMINUS_VERSION=3.2.2 \ - JQ_VERSION=1.7 \ - YQ_VERSION=4.35.2 + PLATFORMSH_CLI_VERSION=5.0.8 \ + ACQUIA_CLI_VERSION=2.22.1 \ + TERMINUS_VERSION=3.3.3 \ + JQ_VERSION=1.7.1 \ + YQ_VERSION=4.40.5 RUN set -xe; \ # Composer 1.x curl -fsSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer1; \ @@ -329,9 +329,9 @@ $HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibil # Node.js (installed as user) ENV \ - NVM_VERSION=0.39.5 \ - NODE_VERSION=18.17.0 \ - YARN_VERSION=1.22.19 + NVM_VERSION=0.39.7 \ + NODE_VERSION=20.11.0 \ + YARN_VERSION=1.22.21 # Don't use -x here, as the output may be excessive RUN set -e; \ # NVM and a defaut Node.js version From 495d89b292bffbbadfe49b07c6a807320f821657 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 15:19:08 +0100 Subject: [PATCH 14/23] Use stable xdebug release for PHP 8.3 --- 8.3/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 5c5091d9..3149c872 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -190,8 +190,7 @@ RUN set -xe; \ memcached \ redis \ ssh2 \ - # xdebug PHP 8.3 compatibility is in beta \ - xdebug-beta \ + xdebug \ xhprof \ ;\ docker-php-ext-enable \ From 5b2dfe93b4ae2b4425d17b075e5be3f15cb26b8e Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 16:33:55 +0100 Subject: [PATCH 15/23] Switched to Platform.sh CLI v4.14.1 (legacy-cli) --- 8.1/Dockerfile | 3 ++- 8.2/Dockerfile | 3 ++- 8.3/Dockerfile | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 166c8880..64a3ac9e 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -246,7 +246,8 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - PLATFORMSH_CLI_VERSION=5.0.8 \ + # platformsh/legacy-cli + PLATFORMSH_CLI_VERSION=4.14.1 \ ACQUIA_CLI_VERSION=2.22.1 \ TERMINUS_VERSION=3.3.3 \ JQ_VERSION=1.7.1 \ diff --git a/8.2/Dockerfile b/8.2/Dockerfile index b67094b0..c5678f67 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -246,7 +246,8 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - PLATFORMSH_CLI_VERSION=5.0.8 \ + # platformsh/legacy-cli + PLATFORMSH_CLI_VERSION=4.14.1 \ ACQUIA_CLI_VERSION=2.22.1 \ TERMINUS_VERSION=3.3.3 \ JQ_VERSION=1.7.1 \ diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 3149c872..8a195dd3 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -248,7 +248,8 @@ ENV \ DRUSH_VERSION=8.4.12 \ DRUPAL_CONSOLE_LAUNCHER_VERSION=1.9.7 \ WPCLI_VERSION=2.9.0 \ - PLATFORMSH_CLI_VERSION=5.0.8 \ + # platformsh/legacy-cli + PLATFORMSH_CLI_VERSION=4.14.1 \ ACQUIA_CLI_VERSION=2.22.1 \ TERMINUS_VERSION=3.3.3 \ JQ_VERSION=1.7.1 \ From d8293bc50a680f3dd48ac81f1a999f1277a8f21e Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 16:34:43 +0100 Subject: [PATCH 16/23] Pinned yarn at v1.22.19 Newer version don't install (missing some release artifacts). --- 8.1/Dockerfile | 3 ++- 8.2/Dockerfile | 3 ++- 8.3/Dockerfile | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 64a3ac9e..66e6e3e1 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -329,7 +329,8 @@ $HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibil ENV \ NVM_VERSION=0.39.7 \ NODE_VERSION=20.11.0 \ - YARN_VERSION=1.22.21 + # yarn releases above 1.22.19 don't install + YARN_VERSION=1.22.19 # Don't use -x here, as the output may be excessive RUN set -e; \ # NVM and a defaut Node.js version diff --git a/8.2/Dockerfile b/8.2/Dockerfile index c5678f67..64534754 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -329,7 +329,8 @@ $HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibil ENV \ NVM_VERSION=0.39.7 \ NODE_VERSION=20.11.0 \ - YARN_VERSION=1.22.21 + # yarn releases above 1.22.19 don't install + YARN_VERSION=1.22.19 # Don't use -x here, as the output may be excessive RUN set -e; \ # NVM and a defaut Node.js version diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 8a195dd3..4f1ac1fd 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -331,7 +331,8 @@ $HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibil ENV \ NVM_VERSION=0.39.7 \ NODE_VERSION=20.11.0 \ - YARN_VERSION=1.22.21 + # yarn releases above 1.22.19 don't install + YARN_VERSION=1.22.19 # Don't use -x here, as the output may be excessive RUN set -e; \ # NVM and a defaut Node.js version From dae8f153f09624672ba8f175f1132e5af8e22068 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 17:19:40 +0100 Subject: [PATCH 17/23] Updated terminus test --- tests/test.bats | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test.bats b/tests/test.bats index 4cfe3734..049fce25 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -217,7 +217,8 @@ _healthcheck_wait () unset output # Check Terminus version - run docker exec -u docker "$NAME" bash -lc 'set -x; terminus --version | grep "^Terminus ${TERMINUS_VERSION}$"' + # --no-ansi is used to strip color codes from the output, otherwise the grep will fail + run docker exec -u docker "$NAME" bash -lc 'set -x; terminus --no-ansi --version | grep "^Terminus ${TERMINUS_VERSION}$"' [[ ${status} == 0 ]] unset output From 526069ae35b9c72d3207a44e3065ddad10ea4e24 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 2 Feb 2024 17:30:06 +0100 Subject: [PATCH 18/23] Updated GitHub Actions versions --- .github/workflows/default.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index 8a2776a1..3ecc4e19 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -64,7 +64,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Environment variables run: | @@ -158,7 +158,7 @@ jobs: bats-version: '1.3.0' - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Environment variables run: | @@ -201,7 +201,7 @@ jobs: # Dynamic variable names cannot be used when mapping step outputs to job outputs. # Step outputs cannot be accessed directly from other jobs. Dead end. - name: Store test results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-results path: ${{ github.workspace }}/test-results-*.txt @@ -228,7 +228,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Environment variables run: | @@ -245,7 +245,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Retrieve test results - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: test-results - From b4fe2558f12cfd1b80586d3db7290625addba2d0 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 9 Feb 2024 11:11:26 +0100 Subject: [PATCH 19/23] Enable ftp extension for PHP 8.2 and 8.3 This is no longer enabled by default upstream --- 8.2/Dockerfile | 1 + 8.3/Dockerfile | 1 + 2 files changed, 2 insertions(+) diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 64534754..6e81368f 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -164,6 +164,7 @@ RUN set -xe; \ bz2 \ calendar\ exif \ + ftp \ gd \ gettext \ imap \ diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 4f1ac1fd..b6eac01e 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -164,6 +164,7 @@ RUN set -xe; \ bz2 \ calendar\ exif \ + ftp \ gd \ gettext \ imap \ From c761c89176a968129f7d9cad8fdffc94a70e03b6 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 9 Feb 2024 11:13:32 +0100 Subject: [PATCH 20/23] MS ODBC driver repo and key --- 8.1/Dockerfile | 8 +++----- 8.2/Dockerfile | 8 +++----- 8.3/Dockerfile | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 66e6e3e1..a31a0102 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -208,11 +208,9 @@ RUN set -xe; \ # MSSQL PHP client RUN set -xe; \ - # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv - curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ - # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). - #curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ - curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + # Repo and key for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv + curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg; \ \ buildDeps=" \ unixodbc-dev \ diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 6e81368f..b8be9313 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -209,11 +209,9 @@ RUN set -xe; \ # MSSQL PHP client RUN set -xe; \ - # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv - curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ - # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). - #curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ - curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + # Repo and key for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv + curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg; \ \ buildDeps=" \ unixodbc-dev \ diff --git a/8.3/Dockerfile b/8.3/Dockerfile index b6eac01e..831c537f 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -211,11 +211,9 @@ RUN set -xe; \ # MSSQL PHP client RUN set -xe; \ - # Repo for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv - curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ - # TODO: Using Ubuntu 22.04 packages as a temporary fix (until addressed upstream in MS repos). - #curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ - curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + # Repo and key for msodbcsql18 (MS ODBC driver), required by pecl/sqlsrv and pecl/pdo_sqlsrv + curl -fsSL https://packages.microsoft.com/config/debian/12/prod.list -o /etc/apt/sources.list.d/mssql.list; \ + curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg; \ \ buildDeps=" \ unixodbc-dev \ From 9e18f360685387c4dd1def7ca1f6f73f9b6d6206 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 9 Feb 2024 11:14:47 +0100 Subject: [PATCH 21/23] imagick@master for PHP 8.3 Install imagick@master for PHP 8.3 using mlocati/install-php-extensions --- 8.3/Dockerfile | 9 ++++++++- 8.3/tests/php-modules.sh | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 831c537f..42c529f0 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -186,7 +186,7 @@ RUN set -xe; \ pecl install >/dev/null Date: Fri, 9 Feb 2024 13:48:33 +0100 Subject: [PATCH 22/23] Compatibility fix for actions/upload-artifact@v4 --- .github/workflows/default.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index 3ecc4e19..de666dce 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -203,8 +203,10 @@ jobs: - name: Store test results uses: actions/upload-artifact@v4 with: - name: test-results + name: test-results-${{ env.GIT_SHA7 }}-${{ env.VERSION_PREFIX }}${{ env.VERSION }}-${{ env.ARCH }} path: ${{ github.workspace }}/test-results-*.txt + if-no-files-found: error + overwrite: true push: name: "Push: ${{ matrix.version }}/multi" @@ -247,7 +249,8 @@ jobs: name: Retrieve test results uses: actions/download-artifact@v4 with: - name: test-results + pattern: test-results-${{ env.GIT_SHA7 }}-* + merge-multiple: true - # Generate persistent tags (edge, stable, release) name: Docker image tags From e64dd5f000ccd1a33864a5ae00bac26abc620125 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 9 Feb 2024 15:22:29 +0100 Subject: [PATCH 23/23] Updated Docker Github Actions - docker/login-action@v3 - docker/build-push-action@v5 --- .github/workflows/default.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index de666dce..06568ac8 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -92,14 +92,14 @@ jobs: docker info - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - # Build and cache image in the registry name: Build image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: ${{ env.BUILD_DIR }} file: ${{ env.BUILD_DIR }}/Dockerfile @@ -241,7 +241,7 @@ jobs: - # Login to Docker Hub name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }}