docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

Enable embed also on alpine cli #1355

Closed DracoBlue closed 1 year ago

DracoBlue commented 1 year ago

EDIT 2023/06/25: for those searching for something like this: we rolled our own based on the official alpine packages for php at https://github.com/Endava/docker-php (it supports php 8.0, 8.1 and 8.2 and following).

https://github.com/docker-library/php/pull/1104 added the flag to Debian-based CLI variants; in https://github.com/docker-library/php/pull/1175 was this added for debian based ZTS variants. we use an alpine-based non-zts variant, and would benefit from this flag as well.

Also, NGiNX Unit, the use case scenario mentioned in https://github.com/docker-library/php/pull/1104 [seems to work with ubuntu, but lacks alpine support because of missing embed in cli docker image).

Refs https://github.com/docker-library/php/issues/510 https://github.com/docker-library/php/pull/939 https://github.com/docker-library/php/pull/1175

After the merge it looks like this for 8.1/alpine3.17/cli:

$ php -i | grep Configure
Configure Command =>  './configure'  '--build=aarch64-linux-musl' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--with-pic' '--enable-ftp' '--enable-mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-pdo-sqlite=/usr' '--with-sqlite3=/usr' '--with-curl' '--with-iconv=/usr' '--with-openssl' '--with-readline' '--with-zlib' '--enable-phpdbg' '--enable-phpdbg-readline' '--with-pear' '--enable-embed' 'build_alias=aarch64-linux-musl'
DracoBlue commented 1 year ago

fyi @niepi @oskarstark

DracoBlue commented 1 year ago

fyi @tianon @jnoordsij @dunglas can you trigger the running the workflows?

yosifkit commented 1 year ago

We excluded embed on Alpine images in order for the cli-alpine images to continue to be as small as possible.

we start by adding this to the Debian-based CLI variants (so that the Alpine variants are still as small as is reasonably possible)

they'll be substantially affected by a ~14MB increase in size (which in Alpine's case, is almost a 20% size increase).

https://github.com/docker-library/php/pull/939#issuecomment-733970326

Nginx was not interested in the Alpine variant for Unit: https://github.com/docker-library/php/pull/939#issuecomment-734191748.

DracoBlue commented 1 year ago

@thresheek is this still the case? I am actually searching for a good solution to run alpine nginx unit to have less CVEs in the image!

DracoBlue commented 1 year ago

For reference I created a similiar PR but with request to add it to the fpm builds at https://github.com/docker-library/php/pull/1358 (it is already included in the zts build on non-alpine, so it might be beneficial to do this)

thresheek commented 1 year ago

Hi @DracoBlue not much has changed on Unit side - adding Alpine to our builds will incur some significant maintenance overhead to our releases/docker images. Maybe at some point in the future we'll consider enabling those, but that's definitely not something on top of our priorities list.

DracoBlue commented 1 year ago

Thanks!

DracoBlue commented 1 year ago

for those searching for something like this: we rolled our own based on the official alpine packages for php at https://github.com/Endava/docker-php (it supports php 8.0, 8.1 and 8.2 and following).