Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions php-82/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ RUN find /bref-layer/bref/extensions -type f -exec strip --strip-all {} +
RUN find /bref-layer/lib -type f -exec strip --strip-all {} +


# Compress the PHP binary and the PHP-FPM binary with UPX to reduce their size
# --best: use the best compression method
RUN set -xe; \
export UPX_ARCH=$(test "${IMAGE_VERSION_SUFFIX}" = "x86_64" && echo amd64 || echo arm64); \
curl -L -o upx.tgz https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-${UPX_ARCH}_linux.tar.xz; \
tar xf upx.tgz; \
mv upx-*/upx /usr/local/bin/
RUN upx --best /bref-layer/bin/php && \
upx --best /bref-layer/bin/php-fpm


# ----------------------------------------------------------------------------
# Start from a clean image to copy only the files we need for the Lambda layer
FROM public.ecr.aws/lambda/provided:al2023-${IMAGE_VERSION_SUFFIX} as function
Expand Down
11 changes: 11 additions & 0 deletions php-83/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ RUN find /bref-layer/bref/extensions -type f -exec strip --strip-all {} +
RUN find /bref-layer/lib -type f -exec strip --strip-all {} +


# Compress the PHP binary and the PHP-FPM binary with UPX to reduce their size
# --best: use the best compression method
RUN set -xe; \
export UPX_ARCH=$(test "${IMAGE_VERSION_SUFFIX}" = "x86_64" && echo amd64 || echo arm64); \
curl -L -o upx.tgz https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-${UPX_ARCH}_linux.tar.xz; \
tar xf upx.tgz; \
mv upx-*/upx /usr/local/bin/
RUN upx --best /bref-layer/bin/php && \
upx --best /bref-layer/bin/php-fpm


# ----------------------------------------------------------------------------
# Start from a clean image to copy only the files we need for the Lambda layer
FROM public.ecr.aws/lambda/provided:al2023-${IMAGE_VERSION_SUFFIX} as function
Expand Down
11 changes: 11 additions & 0 deletions php-84/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,17 @@ RUN find /bref-layer/bref/extensions -type f -exec strip --strip-all {} +
RUN find /bref-layer/lib -type f -exec strip --strip-all {} +


# Compress the PHP binary and the PHP-FPM binary with UPX to reduce their size
# --best: use the best compression method
RUN set -xe; \
export UPX_ARCH=$(test "${IMAGE_VERSION_SUFFIX}" = "x86_64" && echo amd64 || echo arm64); \
curl -L -o upx.tgz https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-${UPX_ARCH}_linux.tar.xz; \
tar xf upx.tgz; \
mv upx-*/upx /usr/local/bin/
RUN upx --best /bref-layer/bin/php && \
upx --best /bref-layer/bin/php-fpm


# ----------------------------------------------------------------------------
# Start from a clean image to copy only the files we need for the Lambda layer
FROM public.ecr.aws/lambda/provided:al2023-${IMAGE_VERSION_SUFFIX} as function
Expand Down