Skip to content

Commit

Permalink
chore: initial php8.4 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybellwood committed Dec 1, 2024
1 parent 571ea55 commit b86b5f6
Show file tree
Hide file tree
Showing 6 changed files with 359 additions and 1 deletion.
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.1-fpm \
php-8.2-fpm \
php-8.3-fpm \
php-8.4-fpm \
php-8.1-cli \
php-8.2-cli \
php-8.3-cli \
php-8.4-cli \
php-8.1-cli-drupal \
php-8.2-cli-drupal \
php-8.3-cli-drupal \
php-8.4-cli-drupal \
python-3.8 \
python-3.9 \
python-3.10 \
Expand Down Expand Up @@ -287,13 +290,15 @@ base-images-with-versions += $(experimental-images)
s3-images += $(versioned-images)
s3-images += $(experimental-images)

build/php-8.1-fpm build/php-8.2-fpm build/php-8.3-fpm: build/commons
build/php-8.1-fpm build/php-8.2-fpm build/php-8.3-fpm build/php-8.4-fpm: build/commons
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.4-cli: build/php-8.4-fpm
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/php-8.4-cli-drupal: build/php-8.4-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/python-3.13: build/commons
build/node-18 build/node-20 build/node-22: build/commons
build/node-18-builder build/node-18-cli: build/node-18
Expand Down
46 changes: 46 additions & 0 deletions helpers/TESTING_base_images_dockercompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ docker-compose build && docker-compose up -d
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
docker run --rm --net all-images_default jwilder/dockerize dockerize -wait tcp://php-8-4-dev:9000 -timeout 1m

```

Verification commands
Expand All @@ -44,6 +46,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-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 php-8-4-dev
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep php-8-4-prod
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
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-11
Expand Down Expand Up @@ -182,6 +186,48 @@ docker compose exec -T commons sh -c "curl -kL http://php-8-3-prod:9000" | grep
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"

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

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

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

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

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

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

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 @@ -140,6 +140,39 @@ services:
exec php -S 0.0.0.0:9000
"] # runs a webserver with phpinfo output
php-8-4-dev:
image: uselagoon/php-8.4-cli:latest
ports:
- "9000"
environment:
- LAGOON_ENVIRONMENT_TYPE=development
- XDEBUG_ENABLE=true
- XDEBUG_LOG=true
# - NEWRELIC_ENABLED=true
# - 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-4-prod:
image: uselagoon/php-8.4-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-9:
image: uselagoon/python-3.9:latest
ports:
Expand Down
18 changes: 18 additions & 0 deletions images/php-cli-drupal/8.4.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/php-8.4-cli

ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
LABEL org.opencontainers.image.authors="The Lagoon Authors"
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images/blob/main/images/php-cli-drupal/8.4.Dockerfile"
LABEL org.opencontainers.image.url="https://github.com/uselagoon/lagoon-images"
LABEL org.opencontainers.image.version="${LAGOON_VERSION}"
LABEL org.opencontainers.image.description="PHP 8.4 cli image optimised for Drupal workloads running in Lagoon in production and locally"
LABEL org.opencontainers.image.title="uselagoon/php-8.4-cli-drupal"
LABEL org.opencontainers.image.base.name="docker.io/uselagoon/php-8.4-cli"

ENV LAGOON=cli-drupal

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

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

ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
LABEL org.opencontainers.image.authors="The Lagoon Authors"
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images/blob/main/images/php-cli/8.4.Dockerfile"
LABEL org.opencontainers.image.url="https://github.com/uselagoon/lagoon-images"
LABEL org.opencontainers.image.version="${LAGOON_VERSION}"
LABEL org.opencontainers.image.description="PHP 8.4 cli image optimised for running in Lagoon in production and locally"
LABEL org.opencontainers.image.title="uselagoon/php-8.4-cli"
LABEL org.opencontainers.image.base.name="docker.io/uselagoon/php-8.4-fpm"

ENV LAGOON=cli

STOPSIGNAL SIGTERM

RUN apk add -U --repository http://dl-cdn.alpinelinux.org/alpine/v3.19/main mariadb-client=10.11.6-r0 mariadb-connector-c \
&& apk add --no-cache bash \
coreutils \
findutils \
git \
gzip \
mongodb-tools \
nodejs=~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.8.3/composer.phar \
&& chmod +x /usr/local/bin/composer \
&& mkdir -p /home/.ssh \
&& fix-permissions /home/

# Adding Composer vendor bin directories to $PATH.
ENV PATH="$PATH:/app/vendor/bin:/home/.composer/vendor/bin"
# 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"]
Loading

0 comments on commit b86b5f6

Please sign in to comment.