Skip to content

Commit

Permalink
Drop support for 8.1 and 8.2 php
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti committed Dec 10, 2024
1 parent 503b321 commit 716a7d6
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 215 deletions.
104 changes: 35 additions & 69 deletions openshift/drupal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 && \
Expand All @@ -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 \
Expand Down Expand Up @@ -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

Expand All @@ -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'; \
Expand Down
126 changes: 44 additions & 82 deletions openshift/drupal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down Expand Up @@ -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
Expand Down
28 changes: 13 additions & 15 deletions openshift/drupal/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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`
Expand All @@ -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).

Expand All @@ -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

Expand All @@ -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
Loading

0 comments on commit 716a7d6

Please sign in to comment.