davidalger / docker-images-php

PHP and PHP-FPM images for Docker based on EL 8
https://hub.docker.com/r/davidalger/php
MIT License
15 stars 16 forks source link

Add CentOS 8 images #6

Closed tdgroot closed 3 years ago

tdgroot commented 3 years ago

Caused by #5.

Based on the CentOS 7 base image, I added the CentOS 8 image. Things I changed in the new image:

The non-cli images are copied to make use of the CentOS 8 base image. Nothing else has changed. These extra images can be left out with an optional docker build argument to specify the base image.

Please let me know what you think and if it would be possible to incorporate these changes, so the base OS of the warden images can be a bit more recent.

tdgroot commented 3 years ago

I tested this by rebuilding the warden magento2 images against the CentOS 8 base image and running warden env down && warden env up.

It seems to work (with a few changes) like a charm :).

The changes required for Magento 2 specifically were as follows:

diff --git a/images/php-fpm/Dockerfile b/images/php-fpm/Dockerfile
index eab5749..5352f31 100644
--- a/images/php-fpm/Dockerfile
+++ b/images/php-fpm/Dockerfile
@@ -1,6 +1,6 @@
 ARG PHP_VERSION=
 ARG PHP_VARIANT="fpm-loaders"
-FROM davidalger/php:${PHP_VERSION}-${PHP_VARIANT}
+FROM davidalger/php:${PHP_VERSION}-${PHP_VARIANT}-centos8

 # Clear undesired settings from base fpm images
 ENV COMPOSER_ALLOW_SUPERUSER=
@@ -11,7 +11,7 @@ ENV MAILHOG_PORT    1025

 RUN yum install -y which pv sudo bind-utils python3-pip bash-completion rsync socat oathtool \
         wget ack make gcc gcc-c++ automake autoconf crontabs \
-    && yum install -y --enablerepo=ius mariadb102 \
+    && yum install -y mariadb \
     && yum clean all \
     && rm -rf /var/cache/yum

diff --git a/images/php-fpm/blackfire/Dockerfile b/images/php-fpm/blackfire/Dockerfile
index 6fb18a6..62994a1 100644
--- a/images/php-fpm/blackfire/Dockerfile
+++ b/images/php-fpm/blackfire/Dockerfile
@@ -2,8 +2,7 @@ ARG PHP_VERSION=
 FROM docker.io/wardenenv/php-fpm:${PHP_VERSION}
 USER root

-RUN yum install -y pygpgme \
-    && curl -o - "http://packages.blackfire.io/fedora/blackfire.repo" | sudo tee /etc/yum.repos.d/blackfire.repo \
+RUN curl -o - "http://packages.blackfire.io/fedora/blackfire.repo" | sudo tee /etc/yum.repos.d/blackfire.repo \
     && yum install -y blackfire-php \
     && yum clean all \
     && rm -rf /var/cache/yum
diff --git a/images/php-fpm/magento2/blackfire/Dockerfile b/images/php-fpm/magento2/blackfire/Dockerfile
index 17ba27d..1c7f9ae 100644
--- a/images/php-fpm/magento2/blackfire/Dockerfile
+++ b/images/php-fpm/magento2/blackfire/Dockerfile
@@ -2,8 +2,7 @@ ARG PHP_VERSION
 FROM docker.io/wardenenv/php-fpm:${PHP_VERSION}-magento2
 USER root

-RUN yum install -y pygpgme \
-    && curl -o - "http://packages.blackfire.io/fedora/blackfire.repo" | sudo tee /etc/yum.repos.d/blackfire.repo \
+RUN curl -o - "http://packages.blackfire.io/fedora/blackfire.repo" | sudo tee /etc/yum.repos.d/blackfire.repo \
     && yum install -y blackfire-php \
     && yum clean all \
     && rm -rf /var/cache/yum
davidalger commented 3 years ago

This is amazing. I've built the 7.3 version of the images locally and need to do a little more testing (mostly making sure all the php pkgs are there as they were before) before I publish the change.

~Currently my plan is going to be replicating the old major version tags with -centos7 tag and leaving them around for about 90 days and open an issue announcing the change to the CentOS 8 base image. The change from yum to dnf will most definitely fail any downstream builds relying on these images, so it'll either prompt users to update their base image with the suffix to buy time or upgrade their image builds likewise. I'll have a few things to update (starting with Warden) but am thinking I'll go with this approach because I don't really want to be maintaining multiple builds with different base images.~

I'm testing locally building with this, so I'll have both available for comparison:

IMAGE_NAME=algerdev/php-centos8 ./scripts/build.sh
tdgroot commented 3 years ago

@davidalger this is even better! I proposed the PR to be not too bold, but completely switching the base images to CentOS 8 is what I was actually hoping for :).

The change from yum to dnf will most definitely fail any downstream builds relying on these images. In CentOS 8

yum is still available right?

Looking forward to seeing this generally available 👍

davidalger commented 3 years ago

yum is still available right?

Actually, you are 100% correct here. It's still present in EL 8, it's even available in latest Fedora so I don't know what made me think it was gone completely.

tdgroot commented 3 years ago

It was proposed to be retired in F31: https://fedoraproject.org/wiki/Releases/31/ChangeSet#Retire_YUM_3.

Den4ik commented 3 years ago

@davidalger @tdgroot Are you sure that update is ok? CentOS 8 released end of life in December 2021 CentOS 7 will be supported until June 2024

https://www.keitaro.com/2021/03/16/title-centos-8-is-reaching-its-end-of-life-in-2021/

tdgroot commented 3 years ago

Good point.. we could do two things here:

I'd prefer to make use of CentOS Stream because of the following reasons:

EDIT: Added info about Alma Linux EDIT 2: Added personal note

tdgroot commented 3 years ago

@davidalger Changing the base image from centos:8 to quay.io/centos/centos:stream8 works fine. I also tested the configuration by compiling the Warden specific images and running development environments using those images.

davidalger commented 3 years ago

I think it's OK to have these on EL 8 base images even with the EOL being nearer in view. It's moving things forward in a big way, and curl lib version compatibility issues aren't even the first underlying lib version issue that I've seen (this one was an iculib version in Magento for example) in the wild. Seeing as EL 7 is is equivalent to Fedora 19/20 and EL 8 equiv to Fedora 28, this is a good jump forward.

As for what's next, there is time to decide, and as @tdgroot pointed out there are multiple options. I'm hesitant to put the images on Stream now as although it is practically identical to CentOS 8, in actuality it is a nightly rebuild of RHEL and is more of a rolling release which would likely preclude the use of these as base images for production container deployments. Rocky may be a good choice as well, but time will tell, and we have multiple other possible options as well.

I'm curious to see what Elastic will do, as their images were formerly based on CentOS 7, and are also based on CentOS 8, so will run up against a similar EOL and have to decide what to keep using as their base image.

davidalger commented 3 years ago

Tags remaining on EL 7 base image:

Existing tags which will be rebuilt on EL 8 base image when merged: