Answer the question
In order to leave comments, you need to log in
What is the point of building a php image on ubuntu vs php?
I collected two similar images from PHP - one FROM ubuntu: 21.04 the second FROM php: 7.4-fpm - the difference in size is 640 versus 600 MB. But it needs php extensions
- php php-cli php-fpm php-pgsql php-gd php-curl php-json php-mbstring php-memcached php-xml php-zip php-bz2 php-apcu php-amqp curl git zip memcached unzip gettext In
the second case, it takes
twice as long to collect them from sources than if you just install them on ubuntu .
Answer the question
In order to leave comments, you need to log in
To reduce the final size of the image, and drag only what is necessary for the application to work.
If you are completely satisfied with the FROM ubuntu option - use it, because it also, unlike alpine, uses the standard glibc, instead of the compact one in alpine.
Use binary packages, no need to build from source.
Take PHP in sury repositories (because it's convenient). If you don’t screw up with layers, the size of the final image will not exceed 250 megabytes.
You got more than 600 and it's strange, apparently you forgot to erase the garbage or did it wrong, for example, in another layer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question