Skip to content

Commit

Permalink
Merge pull request #877 from uselagoon/testing/php83
Browse files Browse the repository at this point in the history
Add PHP8.3 images
  • Loading branch information
tobybellwood authored Dec 10, 2023
2 parents 652e281 + 7879d78 commit 43ecfb2
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,15 @@ build/rabbitmq-cluster: build/rabbitmq images/rabbitmq-cluster/Dockerfile
versioned-images := php-8.0-fpm \
php-8.1-fpm \
php-8.2-fpm \
php-8.3-fpm \
php-8.0-cli \
php-8.1-cli \
php-8.2-cli \
php-8.3-cli \
php-8.0-cli-drupal \
php-8.1-cli-drupal \
php-8.2-cli-drupal \
php-8.3-cli-drupal \
python-3.8 \
python-3.9 \
python-3.10 \
Expand Down Expand Up @@ -278,13 +281,15 @@ base-images-with-versions += $(experimental-images)
s3-images += $(versioned-images)
s3-images += $(experimental-images)

build/php-8.0-fpm build/php-8.1-fpm build/php-8.2-fpm: build/commons
build/php-8.0-fpm build/php-8.1-fpm build/php-8.2-fpm build/php-8.3-fpm: build/commons
build/php-8.0-cli: build/php-8.0-fpm
build/php-8.1-cli: build/php-8.1-fpm
build/php-8.2-cli: build/php-8.2-fpm
build/php-8.3-cli: build/php-8.3-fpm
build/php-8.0-cli-drupal: build/php-8.0-cli
build/php-8.1-cli-drupal: build/php-8.1-cli
build/php-8.2-cli-drupal: build/php-8.2-cli
build/php-8.3-cli-drupal: build/php-8.3-cli
build/python-3.7 build/python-3.8 build/python-3.9 build/python-3.10 build/python-3.11 build/python-3.12: build/commons
build/node-18 build/node-20: build/commons
build/node-18-builder build/node-18-cli: build/node-18
Expand Down
45 changes: 45 additions & 0 deletions helpers/TESTING_base_images_dockercompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ docker-compose build && docker-compose up -d
docker run --rm --net all-images_default jwilder/dockerize dockerize -wait tcp://php-8-0-dev:9000 -timeout 1m
docker run --rm --net all-images_default jwilder/dockerize dockerize -wait tcp://php-8-1-dev:9000 -timeout 1m
docker run --rm --net all-images_default jwilder/dockerize dockerize -wait tcp://php-8-2-dev:9000 -timeout 1m
docker run --rm --net all-images_default jwilder/dockerize dockerize -wait tcp://php-8-3-dev:9000 -timeout 1m
```

Verification commands
Expand All @@ -43,6 +44,8 @@ docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep php-8-1-prod
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep php-8-2-dev
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep php-8-2-prod
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep php-8-3-dev
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep php-8-3-prod
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-8
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-9
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-10
Expand Down Expand Up @@ -181,6 +184,48 @@ docker-compose exec -T commons sh -c "curl -kL http://php-8-2-prod:9000" | grep
docker-compose exec -T commons sh -c "curl -kL http://php-8-2-prod:9000" | grep "upload_max_filesize" | grep "1024M"
docker-compose exec -T commons sh -c "curl -kL http://php-8-2-prod:9000" | grep "error_reporting" | grep "22519"

# PHP 8.3 development should have PHP installed
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "PHP Version" | grep "8.3"
docker-compose exec -T php-8-3-dev bash -c "php -i" | grep "PHP Version" | grep "8.3"

# PHP 8.3 development should have modules enabled
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "APCu Support" | grep "Enabled"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "LibYAML Support" | grep "enabled"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "Redis Support" | grep "enabled"
# TODO docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "imagick module" | grep "enabled"

# PHP 8.3 development should have default configuration.
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "memory_limit" | grep "400M"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "short_open_tag" | grep "On"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "max_execution_time" | grep "900"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "max_input_time" | grep "900"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "post_max_size" | grep "2048M"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "max_input_vars" | grep "2000"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "max_file_uploads" | grep "20"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "session.cookie_samesite" | grep "no value"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "display_errors" | grep "Off"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "date.timezone" | grep "UTC"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "opcache.memory_consumption" | grep "256"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "error_reporting" | grep "22527"
docker-compose exec -T php-8-3-dev bash -c "php -i" | grep "sendmail_path" | grep "/usr/sbin/sendmail -t -i"

# PHP 8.3 development should have extensions enabled.
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "xdebug.client_port" | grep "9003"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "PHP_IDE_CONFIG" | grep "serverName=lagoon"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "xdebug.log" | grep "/tmp/xdebug.log"
# TODO docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "newrelic.appname" | grep "noproject-nobranch"
# TODO docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "newrelic.application_logging.enabled" | grep "disabled"
# TODO docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "newrelic.logfile" | grep "/dev/stderr"
# TODO docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "Blackfire" | grep "enabled"
# TODO docker-compose exec -T commons sh -c "curl -kL http://php-8-3-dev:9000" | grep "blackfire.agent_socket" | grep "tcp://127.0.0.1:8307"

# PHP 8.3 production should have overridden configuration.
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-prod:9000" | grep "max_input_vars" | grep "4000"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-prod:9000" | grep "max_file_uploads" | grep "40"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-prod:9000" | grep "session.cookie_samesite" | grep "Strict"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-prod:9000" | grep "upload_max_filesize" | grep "1024M"
docker-compose exec -T commons sh -c "curl -kL http://php-8-3-prod:9000" | grep "error_reporting" | grep "22519"

# python-3-8 should be version 3.8
docker-compose exec -T python-3-8 sh -c "python -V" | grep "3.8"

Expand Down
33 changes: 33 additions & 0 deletions helpers/images-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,39 @@ services:
exec php -S 0.0.0.0:9000
"] # runs a webserver with phpinfo output
php-8-3-dev:
image: uselagoon/php-8.3-cli:latest
ports:
- "9000"
environment:
- LAGOON_ENVIRONMENT_TYPE=development
- XDEBUG_ENABLE=true
- XDEBUG_LOG=true
# TODO - NEWRELIC_ENABLED=true
# TODO - BLACKFIRE_ENABLED=true
- NEWRELIC_APPLICATION_LOGGING_ENABLED=false
<< : *default-user # uses the defined user from top
command: ["sh", "-c", "
echo PD9waHAKCnBocGluZm8oICk7Cgo/Pg== | base64 -d > /app/index.php;
exec php -S 0.0.0.0:9000
"] # runs a webserver with phpinfo output
php-8-3-prod:
image: uselagoon/php-8.3-cli:latest
ports:
- "9000"
environment:
- LAGOON_ENVIRONMENT_TYPE=production
- PHP_MAX_INPUT_VARS=4000
- PHP_MAX_FILE_UPLOADS=40
- PHP_SESSION_COOKIE_SAMESITE="Strict"
- PHP_UPLOAD_MAX_FILESIZE=1024M
<< : *default-user # uses the defined user from top
command: ["sh", "-c", "
echo PD9waHAKCnBocGluZm8oICk7Cgo/Pg== | base64 -d > /app/index.php;
exec php -S 0.0.0.0:9000
"] # runs a webserver with phpinfo output
python-3-8:
image: uselagoon/python-3.8:latest
ports:
Expand Down
11 changes: 11 additions & 0 deletions images/php-cli-drupal/8.3.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/php-8.3-cli

LABEL org.opencontainers.image.authors="The Lagoon Authors" maintainer="The Lagoon Authors"
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images" repository="https://github.com/uselagoon/lagoon-images"

ENV LAGOON=cli-drupal

COPY drushrc.php drush.yml /home/.drush/

RUN fix-permissions /home/.drush
65 changes: 65 additions & 0 deletions images/php-cli/8.3.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/php-8.3-fpm

LABEL org.opencontainers.image.authors="The Lagoon Authors" maintainer="The Lagoon Authors"
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images" repository="https://github.com/uselagoon/lagoon-images"

ENV LAGOON=cli

RUN apk add --no-cache git \
bash \
coreutils \
findutils \
gzip \
mariadb-client \
mariadb-connector-c \
mongodb-tools \
nodejs-current=~20 \
npm \
openssh-client \
openssh-sftp-server \
patch \
postgresql-client \
procps \
rsync \
unzip \
yarn \
&& ln -s /usr/lib/ssh/sftp-server /usr/local/bin/sftp-server \
&& rm -rf /var/cache/apk/*

RUN curl -L -o /usr/local/bin/composer https://github.com/composer/composer/releases/download/2.6.5/composer.phar \
&& chmod +x /usr/local/bin/composer \
&& mkdir -p /home/.ssh \
&& fix-permissions /home/

# Adding Composer vendor bin directories to $PATH.
ENV PATH="/app/vendor/bin:/home/.composer/vendor/bin:$PATH"
# We not only use "export $PATH" as this could be overwritten again
# like it happens in /etc/profile of alpine Images.

COPY entrypoints /lagoon/entrypoints/

# Remove warning about running as root in composer
ENV COMPOSER_ALLOW_SUPERUSER=1

# Making sure the path is not only added during entrypoint, but also when creating a new shell
RUN echo "source /lagoon/entrypoints/90-composer-path.sh" >> /home/.bashrc
# Make sure shells are not running forever
RUN echo "source /lagoon/entrypoints/80-shell-timeout.sh" >> /home/.bashrc
# Make sure xdebug is automatically enabled also for cli scripts
RUN echo "source /lagoon/entrypoints/61-php-xdebug-cli-env.sh" >> /home/.bashrc
# helper functions
RUN echo "source /lagoon/entrypoints/55-cli-helpers.sh" >> /home/.bashrc

# Copy mariadb-client configuration.
COPY mariadb-client.cnf /etc/my.cnf.d/
RUN fix-permissions /etc/my.cnf.d/

# SSH Key and Agent Setup
COPY ssh_config /etc/ssh/ssh_config
COPY id_ed25519_lagoon_cli.key /home/.ssh/lagoon_cli.key
RUN chmod 400 /home/.ssh/lagoon_cli.key
ENV SSH_AUTH_SOCK=/tmp/ssh-agent

ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"]
CMD ["/bin/docker-sleep"]
3 changes: 2 additions & 1 deletion images/php-fpm/8.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ RUN mkdir -p /tmp/newrelic && cd /tmp/newrelic \
&& mv /usr/local/etc/php/conf.d/newrelic.ini /usr/local/etc/php/conf.d/newrelic.disable \
&& cd / && rm -rf /tmp/newrelic \
&& fix-permissions /usr/local/etc/

# Add blackfire probe and agent.
ENV BLACKFIRE_VERSION=2.23.0
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& mkdir -p /blackfire \
Expand All @@ -140,7 +142,6 @@ RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& mv /blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& fix-permissions /usr/local/etc/php/conf.d/

ENV BLACKFIRE_VERSION=2.23.0
RUN architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& curl -A "Docker" -o /blackfire/blackfire-linux_${architecture}.tar.gz -D - -L -s https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${architecture}.tar.gz \
&& tar zxpf /blackfire/blackfire-linux_${architecture}.tar.gz -C /blackfire \
Expand Down
2 changes: 1 addition & 1 deletion images/php-fpm/8.1.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ RUN mkdir -p /tmp/newrelic && cd /tmp/newrelic \
&& fix-permissions /usr/local/etc/

# Add blackfire probe and agent.
ENV BLACKFIRE_VERSION=2.23.0
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& mkdir -p /blackfire \
Expand All @@ -141,7 +142,6 @@ RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& mv /blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& fix-permissions /usr/local/etc/php/conf.d/

ENV BLACKFIRE_VERSION=2.23.0
RUN architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& curl -A "Docker" -o /blackfire/blackfire-linux_${architecture}.tar.gz -D - -L -s https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${architecture}.tar.gz \
&& tar zxpf /blackfire/blackfire-linux_${architecture}.tar.gz -C /blackfire \
Expand Down
2 changes: 1 addition & 1 deletion images/php-fpm/8.2.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ RUN mkdir -p /tmp/newrelic && cd /tmp/newrelic \
&& fix-permissions /usr/local/etc/

# Add blackfire probe and agent.
ENV BLACKFIRE_VERSION=2.23.0
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& mkdir -p /blackfire \
Expand All @@ -141,7 +142,6 @@ RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& mv /blackfire/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& fix-permissions /usr/local/etc/php/conf.d/

ENV BLACKFIRE_VERSION=2.23.0
RUN architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& curl -A "Docker" -o /blackfire/blackfire-linux_${architecture}.tar.gz -D - -L -s https://packages.blackfire.io/binaries/blackfire/${BLACKFIRE_VERSION}/blackfire-linux_${architecture}.tar.gz \
&& tar zxpf /blackfire/blackfire-linux_${architecture}.tar.gz -C /blackfire \
Expand Down
Loading

0 comments on commit 43ecfb2

Please sign in to comment.