docker-library / php

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

Most debian images has gcc #1528

Closed firecow closed 3 months ago

firecow commented 3 months ago

dive php:8.3.9-zts-bookworm shows that gcc is added to a layer, causing all debian images to use 125mb extra.

image

Something like this seems to get php building and reduces the image size significantly

Index: Dockerfile-linux.template
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template
--- a/Dockerfile-linux.template (revision 67bf0a36045d27dfe4f83042c823bb2e0785d15d)
+++ b/Dockerfile-linux.template (date 1720461001944)
@@ -63,7 +63,6 @@
 RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
-       $PHPIZE_DEPS \
        ca-certificates \
        curl \
        xz-utils \
@@ -262,6 +261,7 @@
        else
            # debian packages
            if env.variant == "apache" then "apache2-dev" else empty end,
+           "$PHPIZE_DEPS",
            "libargon2-dev",
            "libcurl4-openssl-dev",
            "libreadline-dev",
tianon commented 3 months ago

Duplicate of #438; see discussion there, especially https://github.com/docker-library/php/pull/438#issuecomment-353695749