-
Notifications
You must be signed in to change notification settings - Fork 800
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
Docker Feature Request: Easy ability to change php versions for unit tests #32914
Comments
Hmm... I think a Just thought I'd note it down for when we come back to it. |
That makes sense. Do you think it'd make sense to see if possible to pull in existing php containers and separate the WordPress application from the php layer? Of course, if an existing container doesn't work for us, we can grow our own. |
In general yes, though looking at it right now, looks like we currently just have one image with everything on it. There is nothing inherently wrong with that, but I think it'd be good start versioning it, that way you can always pull what you need. Official WordPress images would be a good example, with tags like Another solution would be to have all PHP versions installed simultaneously which I think you can do. And we could maybe dynamically assign |
I'm not sure what this means. But it's unlikely there are any existing base images that have PHP, Node, and pnpm all installed (and all at versions we want). Building additional images isn't particularly hard, just time-consuming. Particularly the ARM-compatible images for Mac users.
Debian and Ubuntu do support this. The downside is that the image would be larger. The current image (with 8.2) is 665MB when I rebuild it locally, adding 7.4, 8.0, and 8.1 increases it to 742MB. More versions would increase it further. |
It's always a tradeoff. 100MB or even 200MB is a small price to pay if you ask me though, especially considering it's a set-it-and-forget-it type of thing. We won't be deploying these anywhere. So I think that's a good place to start, and then at some point we can maybe work some CLI magic to install the extra versions on demand when you use them for the first time? But I'd say that's beyond the scope of the initial solution. |
That's not much harder really. Maybe even slightly easier. All it takes is a script that basically duplicates jetpack/tools/docker/Dockerfile Lines 46 to 69 in 68911cb
|
I created a bit of a proof-of-concept at #32929. I'm not really sure how usable any ability to select different PHP versions is really going to turn out to be though. Copying the caveats from the doc update in that PR:
|
There's now a second proof-of-concept at #32979. That one adds a |
We wound up merging the second PR, adding Someone who wanted to manually switch the php version inside the container with |
The specific user story was for phpunit tests so going to update the title and considered fixed. If folks want/need more for general usage, let's do a new issue. |
Impacted plugin
None / Other
What
Easily switch versions of php for the Docker container
How
Right now, if I wanted to switch php versions in Docker, I believe the best path is
jetpack docker sh
and useapt install
to install a new version of php and required libraries.It would be nice if there was a way to do something like
jetpack docker php 8.2
orjetpack docker config --php=8.2
or whatever to switch between versions of PHP.In addition to simply installing the basic
php8.2
deb package, it would need to install the libraries that WordPress requires (e.g.php8.2-xml php8.2-mbstring php8.2-mysql
).The text was updated successfully, but these errors were encountered: