WiP: One Dockerfile to rule them all
- 2 distros:
bullseyeandalpine 3.16 - One multistage
Dockerfile - Bake definition file updated for ^^ + changed targets to be named with PHP minor versions
.dockerignorefile updated- Some comments added to
Dockerfile
TODO
- Create GHA workflow with bake
Notes
- in
Dockerfileyou cannot use dots inASnames. E.g.alpine3.16- use need to name likealpine316 - Additional PHP minor versions could be added to
docker-bake.hclwhen needed
Testing
Show what is about to go down:
docker buildx bake -f docker-bake.hcl --print
Build all images locally for arm64 arch (with --load and --set "*.platform=linux/arm64" flags):
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/arm64"
Same as previous but build only 1 target from docker-bake.hcl:
docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/arm64" bullseye
Build locally and override image name:
IMAGE_NAME=my/frankenphp docker buildx bake -f docker-bake.hcl --pull --load --set "*.platform=linux/arm64" --progress plain
Build and push all images with override image name (needs you logged in to Docker Hub or some other registry):
IMAGE_NAME=my/frankenphp docker buildx bake -f docker-bake.hcl --pull --push
I got all 4 variants build with docker buildx bake... but buster variant:
docker run --rm --name frankenphp-demo \
-e FRANKENPHP_CONFIG="worker ./public/index.php" \
-e APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime \
-v $PWD:/app \
-p 80:80 -p 443:443 \
dunglas/frankenphp:buster
...fails with following error:
frankenphp: error while loading shared libraries: libphp.so: cannot open shared object file: No such file or directory
@dunglas do you have any idea before I go through the rabbit hole?
@withinboredom WDYT about this one?
@dunglas, if #48 is correct, my gut feeling is to wait for the next RC cut from php-src (probably one more in the next week or two before the actual release later next month -- 24 November) and rip out all the custom PHP build. I think this is a good idea, but maybe wait a bit before optimizing the Dockerfile?
I would also wait with this one. I'll keep it updated with main in a meanwhile.
About Debian Buster, I don't if that error ^^ above is gonna be fixed with new stuff from php-src. Build itself goes through but running the image fails.
And this one needs "bake" version of GHA workflow.
@back-2-95, tbh, I wouldn't worry about a buster version.
Build itself goes through but running the image fails.
Despite regular updates (mostly security related), most of the code/libraries in that image is written for a pretty old kernel version. Linux isn't exactly known for a stable ABI... so all kinds of exciting things might break when running that image on a newer kernel via Docker. It still might be a good idea to build it for people running older kernels, but I feel that if you're willing to run FrankenPHP, you're probably not running an older kernel.
@withinboredom I'm more than willing to cut out older stuff but I was in an impression that we should/could/would support the same distros as the main php docker library? @dunglas ?
As FrankenPHP is still very experimental stuff, I'm also in favor of not supporting older distros.
Maybe cutting out Buster and Alpine3.15 then?
Oh The next release will be the fifth release candidate (RC 5), planned for 27 October 2022. - that's today
@dunglas & @withinboredom this is now with RC5 and buster+alpine3.15 commented out from bake definition (they still can be build but not by default)
Excellent! ! I will check your PR more closely. I may suggest some changes since https://github.com/docker-library/php/pull/1331 hasn't been merged yet, so we will still need to rebuild PHP, but it will be far more straightforward than what exists currently.
Possible GHA action to use: https://github.com/docker/bake-action
I know @crazy-max has done lots of bake stuff so might be worth trying.
Have not been able to continue this. I have been sick the whole week and still going on... 🤧
I'm gonna wait for the time we can ditch the build phase until updating this PR. I was also thinking about just creating a test repo to test bake build/push with Github Actions.
Superseded by https://github.com/dunglas/frankenphp/pull/133