-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Reduced image size by 50% #438
Conversation
This is basically what we do in the alpine-based images. It was a conscious decision to not do this for Debian since the apt packages take significantly longer to install/uninstall and don't uninstall cleanly (especially since in Alpine we install/uninstall the same |
Alpine is sadly no option for me (as i need the ioncube loader). I just want a decent feature set with a decent image size and not extremes with either missing features or gigantic size. |
@kuborgh-hgiesenow ioncube loader has no OS dependency, so alpine images should work for you |
@mikk150 that's not entirely true as Alpine doesn't include glibc, which is what ioncube depends on. I was never able to get ioncube running on alpine based images and for that situation debian-slim seems like a fine alternative for me. |
I wouldn't bet on ioncube ever supporting a distro that isn't based on glibc. If you're a paying customer, raising an issue might have a chance of getting ionCube to address your issue (ie. being runnable on alpine). Otherwise, I'd recommend you to steer clear of any solutions that depend on obfuscation/encryption ala ionCube. |
@hairmare I'm not sure I'm following ... why is the requirement of glibc relevant to me using ioncube (or software that is encrypted with it)? I'm simply saying that the comment of @mikk150 is not entirely correct. There is no OS dependency but it requires glibc which alpine doesn't offer. Therefore, I wonder if there's any problem with offering a debian-slim based image as alternative to alpine. |
See also #513 (comment), which is a good summary of my own thoughts on the matter:
|
can we at least offer |
Any chance to get a |
Not sure I understand the request; the current images are based on php/7.2/stretch/apache/Dockerfile Line 7 in 74b59e1
|
ah sorry didn't notice that |
@tianon Would you be open to a PR that adds |
For others that visits this thread and want to reduce their image size, and want to use the official php images, here is a little trick that helps out. FROM php:8.3.9-zts-bookworm AS php-setup
RUN <<EOF
set -e
# Install extentions
builddeps="$PHPIZE_DEPS perl libzip-dev"
runtimedeps="libzip4"
apt-get update
apt-get --no-install-recommends -qqy install $runtimedeps $builddeps
# Install php extensions
docker-php-ext-install zip
# Cleanup buildeps and apt-get
apt-get purge --auto-remove -y $builddeps
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF
# Since official php debian images has dev tools in them, we remove them in php-setup stage and copy / to scratch
FROM scratch AS main
ENV PHP_INI_DIR=/usr/local/etc/php
# Copy php + pecl extension debian build
COPY --link --from=php-setup / / Notice runtime libs needs to be explicitly set in |
|
I've made my own PHP Docker images based on the official ones, adding useful extensions, Composer, and more. I've also made the images much smaller than the originals, thanks to the docker-squash project. |
With two small hacks, the image size can be reduced from 380 to 167 MB