I have a custom Docker image built with PHP 8.1 and a specific version of node (14). The pipeline executes however error's out that it is using php 8.0 instead of 8.1. I'm not sure where this older version of PHP is coming from.
image: itguy614/gohcl-php-docker-pipeline:php-8.1 pipelines: branches: develop: - step: name: Composer Build script: - cp -v .env.example .env - composer config --global --auth http-basic.repo.gohcl.com $PACKAGIST_USER $PACKAGIST_TOKEN - composer config repositories.private-packagist composer https://repo.gohcl.com/gohcltech/ - composer config repositories.packagist.org false - composer install --no-interaction --no-progress --prefer-dist - php artisan key:generate artifacts: - vendor/** - .env
Problem 1
- Root composer.json requires php ^8.1 but your php version (8.0.16) does not satisfy that requirement.
Hi @kurtwolf,
Since the Docker image is public, I ran a Pipelines build using this image as a build container and included the command php --version at the beginning of the build's script. The output shows PHP 8.1.3, same as locally.
Have you perhaps configured a different version of php in the composer.json file or any other configuration file of your repo?
I would suggest debugging the build locally first, so you don't consume Pipelines minutes for that. You can do so the following way:
1. Take a new clone of the develop branch of the repo on your machine
2. Navigate to the directory of that new clone, and do a git reset --hard to the commit of the failed build with the issue (if it's not the latest commit)
3. Afterwards, start a Docker container with the following command
docker run -it --volume=/Users/myUserName/code/my-repo:/localDebugRepo --workdir="/localDebugRepo" --memory=4g --memory-swap=4g --memory-swappiness=0 --cpus=4 --entrypoint=/bin/bash itguy614/gohcl-php-docker-pipeline:php-8.1
Replace /Users/myUserName/code/my-repo in the command with the path of the clone you took on step 1.
After the Docker container starts, you can run the commands of your yml file's script.
If you get the same error, you can check composer.json or any other configuration files where a different version of php may be defined, make changes in these files locally and then run your build's commands again to see if the issue is resolved.
Kind regards,
Theodora
Your information for debugging got me heading down the right path, thank you. I had installed composer using `apk` which has a built in dependency of php8.0 even though I'm using the official php8.1 image. I instead manually installed composer into my image and things started clicking.
Thank you very much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the update @kurtwolf, you are very welcome and I'm glad that you figured this out.
Please feel free to reach out if you ever need anything else!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.