From 716a7d6fafad9c6520786a92afae69bee99a33f1 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 10 Dec 2024 09:25:56 +0200 Subject: [PATCH] Drop support for 8.1 and 8.2 php --- openshift/drupal/Dockerfile | 104 +++++---------- openshift/drupal/Makefile | 126 ++++++------------ openshift/drupal/README.md | 28 ++-- openshift/drupal/docker-bake.hcl | 41 ++---- openshift/drupal/tests/php81.yaml | 16 --- .../drupal/tests/{php82.yaml => php84.yaml} | 5 +- 6 files changed, 105 insertions(+), 215 deletions(-) delete mode 100644 openshift/drupal/tests/php81.yaml rename openshift/drupal/tests/{php82.yaml => php84.yaml} (80%) diff --git a/openshift/drupal/Dockerfile b/openshift/drupal/Dockerfile index db48e80..a1b355b 100644 --- a/openshift/drupal/Dockerfile +++ b/openshift/drupal/Dockerfile @@ -2,7 +2,7 @@ ARG PHP_VERSION ARG PHP_SHORT_VERSION ARG ALPINE_VERSION -FROM alpine:${ALPINE_VERSION} as php +FROM alpine:${ALPINE_VERSION} AS php RUN echo 'export PS1="[${APP_ENV:-env}] \[\e[1;31m\][${HOSTNAME:-hostname}] \[\e[1;33m\]\w\[\e[0m\] $ "' >> /etc/profile ENV ENV="/etc/profile" @@ -48,10 +48,9 @@ COPY files/ / RUN chmod +x /entrypoints/* && \ chmod +x /usr/local/bin/entrypoint -# Create missing nginx folder. -RUN mkdir -p /run/nginx - RUN \ + # Create missing nginx folder. + mkdir -p /run/nginx && \ # COMPOSER_HOME permissions. mkdir -p $COMPOSER_HOME && \ chmod -R a+rwx $COMPOSER_HOME && \ @@ -68,68 +67,7 @@ ENTRYPOINT ["/sbin/tini", "--"] # Default command: Start up multiple services via entrypoint CMD ["entrypoint"] -FROM php as php81 -RUN set -eux; \ - apk --no-cache add \ - php81-pear \ - php81-fpm \ - php81-curl \ - php81-fileinfo \ - php81-iconv \ - php81-mbstring \ - php81-opcache \ - php81-openssl \ - php81-phar \ - php81-session \ - php81-zip \ - php81-dom \ - php81-pdo \ - php81-pdo_mysql \ - php81-tokenizer \ - php81-xmlreader \ - php81-xmlwriter \ - php81-simplexml \ - php81-ctype \ - php81-gd \ - php81-sodium \ - php81-pecl-apcu \ - php81-pecl-imagick \ - php81-pecl-redis; \ - ln -sfn /usr/bin/php81 /usr/bin/php && \ - ln -sfn /usr/sbin/php-fpm81 /usr/bin/php-fpm; - -FROM php as php82 -RUN set -eux; \ - apk --no-cache add \ - php82-pear \ - php82-fpm \ - php82-curl \ - php82-fileinfo \ - php82-iconv \ - php82-mbstring \ - php82-opcache \ - php82-openssl \ - php82-phar \ - php82-session \ - php82-zip \ - php82-dom \ - php82-pdo \ - php82-pdo_mysql \ - php82-tokenizer \ - php82-xmlreader \ - php82-xmlwriter \ - php82-simplexml \ - php82-ctype \ - php82-gd \ - php82-sodium \ - php82-pecl-apcu \ - php82-pecl-redis; \ - apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main add \ - php82-pecl-imagick; \ - ln -sfn /usr/bin/php82 /usr/bin/php && \ - ln -sfn /usr/sbin/php-fpm82 /usr/bin/php-fpm; - -FROM php as php83 +FROM php AS php83 RUN set -eux; \ apk --no-cache add \ php83-pear \ @@ -160,7 +98,37 @@ RUN set -eux; \ ln -sfn /usr/bin/php83 /usr/bin/php && \ ln -sfn /usr/sbin/php-fpm83 /usr/bin/php-fpm; -FROM php${PHP_SHORT_VERSION} as final +FROM php AS php84 +RUN set -eux; \ + apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main add \ + php84-pear \ + php84-fpm \ + php84-curl \ + php84-fileinfo \ + php84-iconv \ + php84-mbstring \ + php84-opcache \ + php84-openssl \ + php84-phar \ + php84-session \ + php84-zip \ + php84-dom \ + php84-pdo \ + php84-pdo_mysql \ + php84-tokenizer \ + php84-xmlreader \ + php84-xmlwriter \ + php84-simplexml \ + php84-ctype \ + php84-gd \ + php84-sodium \ + php84-pecl-apcu \ + php84-pecl-redis \ + php84-pecl-imagick; \ + ln -sfn /usr/bin/php84 /usr/bin/php && \ + ln -sfn /usr/sbin/php-fpm84 /usr/bin/php-fpm; + +FROM php${PHP_SHORT_VERSION} AS final ARG PHP_SHORT_VERSION @@ -175,8 +143,6 @@ RUN { \ echo 'opcache.validate_timestamps=0'; \ } > /etc/php${PHP_SHORT_VERSION}/conf.d/opcache-recommended.ini -# Override memory limit and upload max filesize and post max size -# to enable bigger uploads RUN { \ echo 'memory_limit=512M'; \ echo 'upload_max_filesize=32M'; \ diff --git a/openshift/drupal/Makefile b/openshift/drupal/Makefile index 32473a3..bad7511 100644 --- a/openshift/drupal/Makefile +++ b/openshift/drupal/Makefile @@ -10,101 +10,25 @@ help: # php-dev # ########### PHONY += build-php-dev -build-php-dev: build-php81-dev build-php82-dev build-php83-dev +build-php-dev: build-php83-dev build-php84-dev PHONY += push-php-dev -push-php-dev: push-php81-dev push-php82-dev push-php83-dev +push-php-dev: push-php83-dev push-php84-dev PHONY += test-php-dev -test-php-dev: test-php81-dev test-php82-dev test-php83-dev +test-php-dev: test-php83-dev test-php84-dev ####### # php # ####### PHONY += test-php -test-php: test-php81 test-php82 test-php83 +test-php: test-php83 test-php84 PHONY += push-php -push-php: push-php81 push-php82 push-php83 +push-php: push-php83 push-php84 PHONY += build-php -build-php: build-php81 build-php82 build-php83 - -########### -# 8.1-dev # -########### -PHONY += build-php81-dev -build-php81-dev: - $(call build_image,php81-dev) - -PHONY += run-php81-dev -run-php81-dev: - docker run -it --rm -u 100000 $(REPOSITORY):8.1-dev /bin/sh - -PHONY += push-php81-dev -push-php81-dev: test-php81-dev - docker push $(REPOSITORY):8.1-dev - -PHONY += test-php81-dev -test-php81-dev: build-php81-dev - $(call run_tests,8.1-dev) - -####### -# 8.1 # -####### -PHONY += build-php81 -build-php81: - $(call build_image,php81) - -PHONY += run-php81 -run-php81: - docker run -it --rm -u 100000 $(REPOSITORY):8.1 /bin/sh - -PHONY += push-php81 -push-php81: test-php81 - docker push $(REPOSITORY):8.1 - -PHONY += test-php81 -test-php81: build-php81 - $(call run_tests,8.1) - -########### -# 8.2-dev # -########### -PHONY += build-php82-dev -build-php82-dev: - $(call build_image,php82-dev) - -PHONY += run-php82-dev -run-php82-dev: - docker run -it --rm -u 100000 $(REPOSITORY):8.2-dev /bin/sh - -PHONY += test-php82-dev -test-php82-dev: build-php82-dev - $(call run_tests,8.2-dev) - -PHONY += push-php82-dev -push-php82-dev: test-php82-dev - docker push $(REPOSITORY):8.2-dev - -####### -# 8.2 # -####### -PHONY += build-php82 -build-php82: - $(call build_image,php82) - -PHONY += run-php82 -run-php82: - docker run -it --rm -u 100000 $(REPOSITORY):8.2 /bin/sh - -PHONY += test-php82 -test-php82: build-php82 - $(call run_tests,8.2) - -PHONY += push-php82 -push-php82: test-php82 - docker push $(REPOSITORY):8.2 +build-php: build-php83 build-php84 ########### # 8.3-dev # @@ -144,6 +68,44 @@ PHONY += push-php83 push-php83: test-php83 docker push $(REPOSITORY):8.3 +########### +# 8.4-dev # +########### +PHONY += build-php84-dev +build-php84-dev: + $(call build_image,php84-dev) + +PHONY += run-php84-dev +run-php84-dev: + docker run -it --rm -u 100000 $(REPOSITORY):8.4-dev /bin/sh + +PHONY += test-php84-dev +test-php84-dev: build-php84-dev + $(call run_tests,8.4-dev) + +PHONY += push-php84-dev +push-php84-dev: test-php84-dev + docker push $(REPOSITORY):8.4-dev + +####### +# 8.4 # +####### +PHONY += build-php84 +build-php84: + $(call build_image,php84) + +PHONY += run-php84 +run-php84: + docker run -it --rm -u 100000 $(REPOSITORY):8.4 /bin/sh + +PHONY += test-php84 +test-php84: build-php84 + $(call run_tests,8.4) + +PHONY += push-php84 +push-php84: test-php84 + docker push $(REPOSITORY):8.4 + define run_tests container-structure-test test --image $(REPOSITORY):$(1) --config tests/php$(subst -dev,,$(subst .,,$(1))).yaml container-structure-test test --image $(REPOSITORY):$(1) --config tests/php.yaml diff --git a/openshift/drupal/README.md b/openshift/drupal/README.md index 9b4c44d..5a75574 100644 --- a/openshift/drupal/README.md +++ b/openshift/drupal/README.md @@ -1,15 +1,13 @@ # OpenShift Drupal base images -Supported PHP versions: `8.3`, `8.2`, `8.1`: +Supported PHP versions: `8.3`, `8.4`: - `ghcr.io/city-of-helsinki/drupal-docker-base:8.3-dev` - `ghcr.io/city-of-helsinki/drupal-docker-base:8.3` -- `ghcr.io/city-of-helsinki/drupal-docker-base:8.2-dev` -- `ghcr.io/city-of-helsinki/drupal-docker-base:8.2` -- `ghcr.io/city-of-helsinki/drupal-docker-base:8.1-dev` -- `ghcr.io/city-of-helsinki/drupal-docker-base:8.1` +- `ghcr.io/city-of-helsinki/drupal-docker-base:8.4-dev` +- `ghcr.io/city-of-helsinki/drupal-docker-base:8.4` -Testing environment uses `*-dev` images by default and it's highly recommended to push changes to `*-dev` tag first and test them on testing environment before pushing them into production (`8.0` tag for example). +Testing environment uses `*-dev` images by default, and it's highly recommended to push changes to `*-dev` tag first and test them on testing environment before pushing them into production (`8.0` tag for example). ## Development @@ -20,7 +18,7 @@ Testing environment uses `*-dev` images by default and it's highly recommended t ### Testing production image locally -- Build the image: `make build-php81-dev` (change `php81` to whatever is your actual PHP version) +- Build the image: `make build-php84-dev` (change `php84` to whatever is your actual PHP version) - Find the image ID of latest `docker images ghcr.io/city-of-helsinki/drupal-docker-base` image and copy the image ID - Change project's `DRUPAL_IMAGE` (in `.env` file) to image ID from previous step - Add `SIMPLETEST_DB: "mysql://drupal:drupal@db:3306/drupal"` to `app` service's environments in `compose.yaml` @@ -31,13 +29,13 @@ Testing environment uses `*-dev` images by default and it's highly recommended t To build a specific image, call: -- `8.1-dev` tag: `make build-php81-dev` -- `8.1` tag: `make build-php81` +- `8.4-dev` tag: `make build-php84-dev` +- `8.4` tag: `make build-php84` To run built image locally: -- `8.1-dev` tag: `make run-php81-dev` -- `8.1` tag: `make run-php81` +- `8.4-dev` tag: `make run-php84-dev` +- `8.4` tag: `make run-php84` You can also build all tags at once: `make build-php-dev` (builds all `*-dev` tags) or `make build-php` (builds stable tags). @@ -47,8 +45,8 @@ We use [GoogleContainerTools/container-structure-test](https://github.com/Google Running tests will always re/build the image first. -- Run tests against `8.1-dev` tag: `make test-php81-dev` -- Run tests against `8.1` tag: `make test-php81` +- Run tests against `8.4-dev` tag: `make test-php84-dev` +- Run tests against `8.4` tag: `make test-php84` ### Release process @@ -61,5 +59,5 @@ Call `make push-php` or `make push-php-dev` to: You can also release a specific tag by: -- `make push-php81-dev`: Build, tests and push the `8.1-dev` tag -- `make push-php81`: Builds, tests and push the `8.1` tag +- `make push-php84-dev`: Build, tests and push the `8.4-dev` tag +- `make push-php84`: Builds, tests and push the `8.4` tag diff --git a/openshift/drupal/docker-bake.hcl b/openshift/drupal/docker-bake.hcl index 8f4765e..a2b5528 100644 --- a/openshift/drupal/docker-bake.hcl +++ b/openshift/drupal/docker-bake.hcl @@ -6,11 +6,11 @@ group "default" { } group "dev" { - targets = ["php81-dev", "php82-dev", "php83-dev"] + targets = ["php83-dev", "php84-dev"] } group "prod" { - targets = ["php81", "php82", "php83"] + targets = ["php83", "php84"] } target "php" { @@ -42,46 +42,25 @@ target "php83" { platforms = ["linux/amd64"] } -target "php82-dev" { +target "php84-dev" { inherits = ["php"] args = { - PHP_VERSION = "8.2" - PHP_SHORT_VERSION = "82" + PHP_VERSION = "8.4" + PHP_SHORT_VERSION = "84" ALPINE_VERSION = "3.20" } - tags = ["${REPO_BASE}:8.2-dev"] + tags = ["${REPO_BASE}:8.4-dev"] platforms = ["linux/amd64"] } -target "php82" { +target "php84" { inherits = ["php"] args = { - PHP_VERSION = "8.2" - PHP_SHORT_VERSION = "82" + PHP_VERSION = "8.4" + PHP_SHORT_VERSION = "84" ALPINE_VERSION = "3.20" } - tags = ["${REPO_BASE}:8.2"] + tags = ["${REPO_BASE}:8.4"] platforms = ["linux/amd64"] } -target "php81-dev" { - inherits = ["php"] - args = { - PHP_VERSION = "8.1" - PHP_SHORT_VERSION = "81" - ALPINE_VERSION = "3.19" - } - tags = ["${REPO_BASE}:8.1-dev"] - platforms = ["linux/amd64"] -} - -target "php81" { - inherits = ["php"] - args = { - PHP_VERSION = "8.1" - PHP_SHORT_VERSION = "81" - ALPINE_VERSION = "3.19" - } - tags = ["${REPO_BASE}:8.1"] - platforms = ["linux/amd64"] -} diff --git a/openshift/drupal/tests/php81.yaml b/openshift/drupal/tests/php81.yaml deleted file mode 100644 index 4d2e03c..0000000 --- a/openshift/drupal/tests/php81.yaml +++ /dev/null @@ -1,16 +0,0 @@ -schemaVersion: '2.0.0' -commandTests: - - name: 'PHP version' - command: php - args: ['--version'] - expectedOutput: ['PHP 8.1.*'] - - - name: 'PHP version' - command: php-fpm - args: ['--version'] - expectedOutput: ['PHP 8.1.*'] - - - name: 'Alpine version' - command: cat - args: ['/etc/alpine-release'] - expectedOutput: ['3.19.*'] diff --git a/openshift/drupal/tests/php82.yaml b/openshift/drupal/tests/php84.yaml similarity index 80% rename from openshift/drupal/tests/php82.yaml rename to openshift/drupal/tests/php84.yaml index 915bdfc..441dee2 100644 --- a/openshift/drupal/tests/php82.yaml +++ b/openshift/drupal/tests/php84.yaml @@ -1,14 +1,15 @@ + schemaVersion: '2.0.0' commandTests: - name: 'PHP version' command: php args: ['--version'] - expectedOutput: ['PHP 8.2.*'] + expectedOutput: ['PHP 8.4.*'] - name: 'PHP version' command: php-fpm args: ['--version'] - expectedOutput: ['PHP 8.2.*'] + expectedOutput: ['PHP 8.4.*'] - name: 'Alpine version' command: cat