-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Spirit-act
wants to merge
2
commits into
Codeception:main
Choose a base branch
from
Spirit-act:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>
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. 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.