make PHP Version configurable by Spirit-act · Pull Request #6822 · Codeception/Codeception · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

make PHP Version configurable #6822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Spirit-act
Copy link

This merge request is a follow up to #6770 and issue #6769.

Changes

It adds a build arg to specify the PHP Version you want to build.

I also updated the COMPOSER_ALLOW_SUPERUSER env variable to the current format.

Docker Hub

I could not figure out, how to Docker Hub Containers are build, but with this Dockerfile and a matrix pipeline, multiple versions could be build and published.

Add a build arg to specify the PHP Version to build with.

Also change legacy ENV declaration.

Signed-off-by: Spirit-act <16631523+Spirit-act@users.noreply.github.com>
@Naktibalda
Copy link
Member

@Spirit-act
Copy link
Author

Spirit-act commented Feb 14, 2025

Thanks for the Link, I forgot to look at the GitHub wiki.

If I understand correctly, in order to adopt my changes, only the docs section for the build needs to be changed.

cd Codeception

# Build with default PHP Version (8.1)
docker build --no-cache --pull -t codeception/codeception:5.0.3 .
docker build --no-cache --pull --build-arg flavor=alpine -t codeception/codeception:5.0.3-alpine .

# Push default build
docker push codeception/codeception:5.0.3
docker push codeception/codeception:5.0.3-alpine


# Build with PHP 8.2
docker build --no-cache --pull \
    --build-arg flavor=PHP_VERSION=8.2 -t codeception/codeception:5.0.3-php8.2 .
docker build --no-cache --pull \
    --build-arg flavor=PHP_VERSION=8.2 \
    --build-arg flavor=alpine -t codeception/codeception:5.0.3-php8.2-alpine .

# Push PHP8.2 build
docker push codeception/codeception:5.0.3-php8.2
docker push codeception/codeception:5.0.3-php8.2-alpine


# Build with PHP 8.3
docker build --no-cache --pull \
    --build-arg flavor=PHP_VERSION=8.3 -t codeception/codeception:5.0.3-php8.3 .
docker build --no-cache --pull \
    --build-arg flavor=PHP_VERSION=8.3 \
    --build-arg flavor=alpine -t codeception/codeception:5.0.3-php8.3-alpine .

# Push PHP8.3 build
docker push codeception/codeception:5.0.3-php8.3
docker push codeception/codeception:5.0.3-php8.3-alpine


# Build with PHP 8.4
docker build --no-cache --pull \
    --build-arg flavor=PHP_VERSION=8.4 -t codeception/codeception:5.0.3-php8.4 .
docker build --no-cache --pull \
    --build-arg flavor=PHP_VERSION=8.4 \
    --build-arg flavor=alpine -t codeception/codeception:5.0.3-php8.4-alpine .

# Push PHP8.4 build
docker push codeception/codeception:5.0.3-php8.4
docker push codeception/codeception:5.0.3-php8.4-alpine


# Tag default build as latest
docker tag codeception/codeception:5.0.3 codeception/codeception:latest
docker tag codeception/codeception:5.0.3-alpine codeception/codeception:latest-alpine

# Push latest tag
docker push codeception/codeception:latest
docker push codeception/codeception:latest-alpine

It would also be possible to wrap this in a script. Example:

#!/bin/bash

PHP_VERSIONS=(
    '8.1'
    '8.2'
    '8.3'
    '8.4'
)

if [[ -z "$1" ]]; then
    echo "Please specify the Codeception Version (e.g.: 5.0.3)."
    exit 1;
fi

echo " - build default images - "
docker build --no-cache --pull -t codeception/codeception:${1} .
docker build --no-cache --pull --build-arg flavor=alpine -t codeception/codeception:${1}-alpine .
echo ""

for VERSION in "${PHP_VERSIONS[@]}"; do
    echo " - build ${VERSION} image - "
    docker build --no-cache --pull --build-arg flavor=PHP_VERSION=$VERSION -t codeception/codeception:${1}-php${VERSION} .
    docker build --no-cache --pull --build-arg flavor=PHP_VERSION=$VERSION --build-arg flavor=alpine -t codeception/codeception:${1}-php${VERSION}-alpine .

    echo " - push ${VERSION} image - "
    docker push codeception/codeception:${1}-php${VERSION}
    docker push codeception/codeception:${1}-php${VERSION}-alpine
    echo ""                                                                                                                                                                                                                                                                                                                 
done                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                            
echo " - tag default build as latest - "                                                                                                                                                                                                                                                                                   
docker tag codeception/codeception:${1} codeception/codeception:latest                                                                                                                                                                                                                                                      
docker tag codeception/codeception:${1}-alpine codeception/codeception:latest-alpine                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                            
echo "- push latest tag - "                                                                                                                                                                                                                                                                                                 
docker push codeception/codeception:latest                                                                                                                                                                                                                                                                                  
docker push codeception/codeception:latest-alpine

If there is something else which needs to be done, feel free to add a comment.
Thanks in advanced.


Edit: The tags for the images are just examples and can be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.