File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,17 @@ RUN set -xe; \
177177 cp php.ini-production ${INSTALL_DIR}/etc/php/php.ini
178178
179179
180+ # Compress the PHP binary and the PHP-FPM binary with UPX to reduce their size
181+ # --best: use the best compression method
182+ RUN set -xe; \
183+ export UPX_ARCH=$(test "${IMAGE_VERSION_SUFFIX}" = "x86_64" && echo amd64 || echo arm64); \
184+ curl -L -o upx.tgz https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-${UPX_ARCH}_linux.tar.xz; \
185+ tar xf upx.tgz; \
186+ mv upx-*/upx /usr/local/bin/
187+ RUN upx --best ${INSTALL_DIR}/bin/php && \
188+ upx --best ${INSTALL_DIR}/sbin/php-fpm
189+
190+
180191# Install extensions
181192# We can install extensions manually or using `pecl`
182193RUN pecl install APCu
Original file line number Diff line number Diff line change @@ -177,6 +177,17 @@ RUN set -xe; \
177177 cp php.ini-production ${INSTALL_DIR}/etc/php/php.ini
178178
179179
180+ # Compress the PHP binary and the PHP-FPM binary with UPX to reduce their size
181+ # --best: use the best compression method
182+ RUN set -xe; \
183+ export UPX_ARCH=$(test "${IMAGE_VERSION_SUFFIX}" = "x86_64" && echo amd64 || echo arm64); \
184+ curl -L -o upx.tgz https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-${UPX_ARCH}_linux.tar.xz; \
185+ tar xf upx.tgz; \
186+ mv upx-*/upx /usr/local/bin/
187+ RUN upx --best ${INSTALL_DIR}/bin/php && \
188+ upx --best ${INSTALL_DIR}/sbin/php-fpm
189+
190+
180191# Install extensions
181192# We can install extensions manually or using `pecl`
182193RUN pecl install APCu
Original file line number Diff line number Diff line change @@ -176,6 +176,17 @@ RUN set -xe; \
176176 cp php.ini-production ${INSTALL_DIR}/etc/php/php.ini
177177
178178
179+ # Compress the PHP binary and the PHP-FPM binary with UPX to reduce their size
180+ # --best: use the best compression method
181+ RUN set -xe; \
182+ export UPX_ARCH=$(test "${IMAGE_VERSION_SUFFIX}" = "x86_64" && echo amd64 || echo arm64); \
183+ curl -L -o upx.tgz https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-${UPX_ARCH}_linux.tar.xz; \
184+ tar xf upx.tgz; \
185+ mv upx-*/upx /usr/local/bin/
186+ RUN upx --best ${INSTALL_DIR}/bin/php && \
187+ upx --best ${INSTALL_DIR}/sbin/php-fpm
188+
189+
179190# Install extensions
180191# We can install extensions manually or using `pecl`
181192RUN pecl install APCu
You can’t perform that action at this time.
0 commit comments