-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: introduce php-helpers
image
#1105
Conversation
php-helpers/Dockerfile
Outdated
echo 'DPkg::Pre-Invoke { "rm -f /var/lib/dpkg/info/*.postinst || true"; };' > /etc/apt/apt.conf.d/99local && \ | ||
xx-apt-get install --no-install-recommends -y -oDPkg::ConfigurePending=0 libglib2.0-dev || true && \ | ||
xx-apt-get install --no-install-recommends -y -oDPkg::ConfigurePending=0 libglib2.0-dev || true && \ | ||
xx-apt-get install --no-install-recommends -y -oDPkg::ConfigurePending=0 libglib2.0-dev && \ | ||
xx-apt-get install --no-install-recommends -y -oDPkg::ConfigurePending=0 \ | ||
zlib1g-dev libpcre3-dev libssl-dev libzstd-dev libmysqlclient-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a nightmare.
libglib2.0-dev
wants python
, python
wants to run a bunch of CPU-heavy scripts, which cannot run on a foreign architecture.
The solution was to ignore errors, remove all installed postinst
scripts, and try until we succeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe try this: https://gist.github.com/kwilczynski/6e4f6f877b5887b9a152225ea5caee28 someday.
php-helpers/Dockerfile
Outdated
xx-apt-get update && \ | ||
apt-get install -y shtool php-pear && \ | ||
sed -i '/^Package: shtool$/a Multi-Arch: foreign' /var/lib/dpkg/status && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xx-apt-get update && \ | ||
apt-get install -y shtool php-pear && \ | ||
sed -i '/^Package: shtool$/a Multi-Arch: foreign' /var/lib/dpkg/status && \ | ||
pecl bundle timezonedb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must download and unpack everything we need from PECL because xx-apt-get install phpXX-dev
might overwrite pecl
with the binary with a foreign architecture, which we cannot run.
That is why we run pecl
here and then forget it existed.
This PR adds a
ghcr.io/automattic/vip-container-images/php-helpers
image to reduce the build time for PHP images.When building a PHP image, we spend a lot of time building mydumper and PHP extensions (and installing build dependencies). This is especially slow for the
linux/arm64
variant because it runs under QEMU.To the contrary, the
php-helpers
image employs cross-compilation instead of emulation. As a result, it takes less than three minutes to build all artifacts for both architectures.To test:
cd php-helpers docker buildx bake ls -1R IMAGE
The expected output is