Skip to content

Commit fcd306b

Browse files
authored
Merge pull request #113 from brefphp/document-zlib-install
Document zlib install
2 parents e345e02 + 284e29a commit fcd306b

File tree

4 files changed

+32
-72
lines changed

4 files changed

+32
-72
lines changed

php-80/Dockerfile

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,35 +71,25 @@ RUN mkdir -p ${BUILD_DIR} \
7171

7272
###############################################################################
7373
# ZLIB Build
74+
# We compile a newer version because Lambda uses an old version (1.2.7) that
75+
# has a security vulnerability (CVE-2022-37434).
76+
# See https://github.com/brefphp/aws-lambda-layers/pull/110
77+
# Can be removed once Lambda updates their version.
7478
# https://github.com/madler/zlib/releases
75-
# Needed for:
76-
# - openssl
77-
# - curl
78-
# - php
79-
# Used By:
80-
# - xml2
8179
ENV VERSION_ZLIB=1.3
82-
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/xml2
83-
80+
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/zlib
8481
RUN set -xe; \
8582
mkdir -p ${ZLIB_BUILD_DIR}; \
86-
# Download and upack the source code
87-
curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz \
88-
| tar xJC ${ZLIB_BUILD_DIR} --strip-components=1
89-
90-
# Move into the unpackaged code directory
83+
curl -Ls https://github.com/madler/zlib/releases/download/v${VERSION_ZLIB}/zlib-${VERSION_ZLIB}.tar.gz \
84+
| tar xzC ${ZLIB_BUILD_DIR} --strip-components=1
9185
WORKDIR ${ZLIB_BUILD_DIR}/
92-
93-
# Configure the build
9486
RUN set -xe; \
9587
make distclean \
9688
&& CFLAGS="" \
9789
CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
9890
LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
9991
./configure \
100-
--prefix=${INSTALL_DIR} \
101-
--64
102-
92+
--prefix=${INSTALL_DIR}
10393
RUN set -xe; \
10494
make install \
10595
&& rm ${INSTALL_DIR}/lib/libz.a

php-81/Dockerfile

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,35 +71,25 @@ RUN mkdir -p ${BUILD_DIR} \
7171

7272
###############################################################################
7373
# ZLIB Build
74+
# We compile a newer version because Lambda uses an old version (1.2.7) that
75+
# has a security vulnerability (CVE-2022-37434).
76+
# See https://github.com/brefphp/aws-lambda-layers/pull/110
77+
# Can be removed once Lambda updates their version.
7478
# https://github.com/madler/zlib/releases
75-
# Needed for:
76-
# - openssl
77-
# - curl
78-
# - php
79-
# Used By:
80-
# - xml2
8179
ENV VERSION_ZLIB=1.3
82-
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/xml2
83-
80+
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/zlib
8481
RUN set -xe; \
8582
mkdir -p ${ZLIB_BUILD_DIR}; \
86-
# Download and upack the source code
87-
curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz \
88-
| tar xJC ${ZLIB_BUILD_DIR} --strip-components=1
89-
90-
# Move into the unpackaged code directory
83+
curl -Ls https://github.com/madler/zlib/releases/download/v${VERSION_ZLIB}/zlib-${VERSION_ZLIB}.tar.gz \
84+
| tar xzC ${ZLIB_BUILD_DIR} --strip-components=1
9185
WORKDIR ${ZLIB_BUILD_DIR}/
92-
93-
# Configure the build
9486
RUN set -xe; \
9587
make distclean \
9688
&& CFLAGS="" \
9789
CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
9890
LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
9991
./configure \
100-
--prefix=${INSTALL_DIR} \
101-
--64
102-
92+
--prefix=${INSTALL_DIR}
10393
RUN set -xe; \
10494
make install \
10595
&& rm ${INSTALL_DIR}/lib/libz.a

php-82/Dockerfile

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,35 +71,25 @@ RUN mkdir -p ${BUILD_DIR} \
7171

7272
###############################################################################
7373
# ZLIB Build
74+
# We compile a newer version because Lambda uses an old version (1.2.7) that
75+
# has a security vulnerability (CVE-2022-37434).
76+
# See https://github.com/brefphp/aws-lambda-layers/pull/110
77+
# Can be removed once Lambda updates their version.
7478
# https://github.com/madler/zlib/releases
75-
# Needed for:
76-
# - openssl
77-
# - curl
78-
# - php
79-
# Used By:
80-
# - xml2
8179
ENV VERSION_ZLIB=1.3
82-
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/xml2
83-
80+
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/zlib
8481
RUN set -xe; \
8582
mkdir -p ${ZLIB_BUILD_DIR}; \
86-
# Download and upack the source code
87-
curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz \
88-
| tar xJC ${ZLIB_BUILD_DIR} --strip-components=1
89-
90-
# Move into the unpackaged code directory
83+
curl -Ls https://github.com/madler/zlib/releases/download/v${VERSION_ZLIB}/zlib-${VERSION_ZLIB}.tar.gz \
84+
| tar xzC ${ZLIB_BUILD_DIR} --strip-components=1
9185
WORKDIR ${ZLIB_BUILD_DIR}/
92-
93-
# Configure the build
9486
RUN set -xe; \
9587
make distclean \
9688
&& CFLAGS="" \
9789
CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
9890
LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
9991
./configure \
100-
--prefix=${INSTALL_DIR} \
101-
--64
102-
92+
--prefix=${INSTALL_DIR}
10393
RUN set -xe; \
10494
make install \
10595
&& rm ${INSTALL_DIR}/lib/libz.a

php-83/Dockerfile

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,35 +72,25 @@ RUN mkdir -p ${BUILD_DIR} \
7272

7373
###############################################################################
7474
# ZLIB Build
75+
# We compile a newer version because Lambda uses an old version (1.2.7) that
76+
# has a security vulnerability (CVE-2022-37434).
77+
# See https://github.com/brefphp/aws-lambda-layers/pull/110
78+
# Can be removed once Lambda updates their version.
7579
# https://github.com/madler/zlib/releases
76-
# Needed for:
77-
# - openssl
78-
# - curl
79-
# - php
80-
# Used By:
81-
# - xml2
8280
ENV VERSION_ZLIB=1.3
83-
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/xml2
84-
81+
ENV ZLIB_BUILD_DIR=${BUILD_DIR}/zlib
8582
RUN set -xe; \
8683
mkdir -p ${ZLIB_BUILD_DIR}; \
87-
# Download and upack the source code
88-
curl -Ls http://zlib.net/zlib-${VERSION_ZLIB}.tar.xz \
89-
| tar xJC ${ZLIB_BUILD_DIR} --strip-components=1
90-
91-
# Move into the unpackaged code directory
84+
curl -Ls https://github.com/madler/zlib/releases/download/v${VERSION_ZLIB}/zlib-${VERSION_ZLIB}.tar.gz \
85+
| tar xzC ${ZLIB_BUILD_DIR} --strip-components=1
9286
WORKDIR ${ZLIB_BUILD_DIR}/
93-
94-
# Configure the build
9587
RUN set -xe; \
9688
make distclean \
9789
&& CFLAGS="" \
9890
CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
9991
LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
10092
./configure \
101-
--prefix=${INSTALL_DIR} \
102-
--64
103-
93+
--prefix=${INSTALL_DIR}
10494
RUN set -xe; \
10595
make install \
10696
&& rm ${INSTALL_DIR}/lib/libz.a

0 commit comments

Comments
 (0)