Skip to content

Commit

Permalink
Merge pull request #4 from devilbox/release-0.4
Browse files Browse the repository at this point in the history
Test PHP OpenSSL against imaps
  • Loading branch information
cytopia authored Mar 20, 2022
2 parents 3285efb + 1674137 commit 53bb206
Show file tree
Hide file tree
Showing 6 changed files with 3,578 additions and 98 deletions.
112 changes: 66 additions & 46 deletions Dockerfiles/Dockerfile.jessie
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ MAINTAINER "cytopia" <[email protected]>
ENV PHP_VERSION=5.4.45
ENV PHP_INI_DIR=/usr/local/etc/php

ENV OPENSSL_VERSION=1.0.1t
# As this is the Jessie Version already, we can skip custom OpenSSL installation

# PHP 5.4 does not work with OpenSSL version from Debian Stretch (need to pick it from Jessie)
# https://github.com/devilbox/docker-php-fpm-5.3/issues/7
#
# https://manpages.debian.org/jessie/openssl/openssl.1ssl.en.html
# https://www.openssl.org/source/old/1.0.1/
#ENV OPENSSL_VERSION=1.0.1t

ENV PHP_BUILD_DEPS \
autoconf2.13 \
Expand All @@ -17,6 +24,7 @@ ENV PHP_BUILD_DEPS \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
# libssl-dev/oldoldstable 1.0.1t-1
libssl-dev \
libxml2-dev

Expand All @@ -25,12 +33,15 @@ ENV PHP_RUNTIME_DEPS \
libpcre3 \
librecode0 \
libsqlite3-0 \
# libssl1.0.0/oldoldstable,now 1.0.1t-1
libssl1.0.0 \
libxml2 \
xz-utils

ENV BUILD_TOOLS \
autoconf \
bison \
bisonc++ \
ca-certificates \
curl \
dpkg-dev \
Expand All @@ -54,50 +65,52 @@ ENV RUNTIME_TOOLS \
curl


# As this is the Jessie Version already, we can skip custom OpenSSL installation

###
### Build OpenSSL
###
RUN set -eux \
# Install Dependencies
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get install -y --no-install-recommends --no-install-suggests \
${BUILD_TOOLS_32}; \
fi \
# Fetch OpenSSL
&& cd /tmp \
&& mkdir openssl \
&& update-ca-certificates \
&& curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
&& curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc \
&& tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
&& cd /tmp/openssl \
# Build OpenSSL
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
setarch i386 ./config -m32; \
else \
./config; \
fi \
&& make depend \
&& make -j"$(nproc)" \
&& make install \
# Cleanup
&& rm -rf /tmp/* \
# Ensure libs are linked to correct architecture directory
&& debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
&& mkdir -p "/usr/local/ssl/lib/${debMultiarch}" \
&& ln -s /usr/local/ssl/lib/* "/usr/local/ssl/lib/${debMultiarch}/" \
# Remove Dependencies
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS_32}; \
fi \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
#RUN set -eux \
## Install Dependencies
# && apt-get update \
# && apt-get install -y --no-install-recommends --no-install-suggests \
# ${BUILD_TOOLS} \
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# apt-get install -y --no-install-recommends --no-install-suggests \
# ${BUILD_TOOLS_32}; \
# fi \
## Fetch OpenSSL
# && cd /tmp \
# && mkdir openssl \
# && update-ca-certificates \
# && curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
# && curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc \
# && tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
# && cd /tmp/openssl \
## Build OpenSSL
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# setarch i386 ./config -m32; \
# else \
# ./config; \
# fi \
# && make depend \
# && make -j"$(nproc)" \
# && make install \
## Cleanup
# && rm -rf /tmp/* \
## Ensure libs are linked to correct architecture directory
# && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
# && mkdir -p "/usr/local/ssl/lib/${debMultiarch}" \
# && ln -s /usr/local/ssl/lib/* "/usr/local/ssl/lib/${debMultiarch}/" \
## Remove Dependencies
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
# ${BUILD_TOOLS_32}; \
# fi \
# && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
# ${BUILD_TOOLS} \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*


###
Expand All @@ -113,6 +126,8 @@ RUN set -eux \
###
COPY data/docker-php-source /usr/local/bin/
COPY data/php/php-${PHP_VERSION}.tar.xz /usr/src/php.tar.xz
# Fix config.guess for PHP itself (adds 'aarch64' [arm64] architecture)
# This file has been manually fixed
COPY data/php/config.guess.patched /usr/src/config.guess


Expand Down Expand Up @@ -157,6 +172,7 @@ RUN set -eux \
--disable-cgi \
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
--with-openssl-dir=/usr \
\
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
Expand All @@ -175,7 +191,7 @@ RUN set -eux \
--with-sqlite3=/usr \
\
--with-curl \
--with-openssl=/usr/local/ssl \
--with-openssl \
--with-readline \
--with-recode \
--with-zlib \
Expand All @@ -186,13 +202,13 @@ RUN set -eux \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& docker-php-source delete \
# Remove Dependencies
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${PHP_BUILD_DEPS} \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS_32}; \
fi \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${PHP_BUILD_DEPS} \
${BUILD_TOOLS} \
# Install Run-time requirements
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
Expand All @@ -201,6 +217,10 @@ RUN set -eux \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Fix config.guess for PHP modules (adds 'aarch64' [arm64] architecture)
# The config.guess has been copied from PHP 5.5
COPY data/php/usr-local-lib-php-build-config.guess /usr/local/lib/php/build/config.guess
COPY data/php/usr-local-lib-php-build-config.sub /usr/local/lib/php/build/config.sub

COPY data/docker-php-* /usr/local/bin/

Expand Down
111 changes: 65 additions & 46 deletions Dockerfiles/Dockerfile.jessie-arm64
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ MAINTAINER "cytopia" <[email protected]>
ENV PHP_VERSION=5.4.45
ENV PHP_INI_DIR=/usr/local/etc/php

ENV OPENSSL_VERSION=1.0.1t
# As this is the Jessie Version already, we can skip custom OpenSSL installation

# PHP 5.4 does not work with OpenSSL version from Debian Stretch (need to pick it from Jessie)
# https://github.com/devilbox/docker-php-fpm-5.3/issues/7
#
# https://manpages.debian.org/jessie/openssl/openssl.1ssl.en.html
# https://www.openssl.org/source/old/1.0.1/
#ENV OPENSSL_VERSION=1.0.1t

ENV PHP_BUILD_DEPS \
autoconf2.13 \
Expand All @@ -17,6 +24,7 @@ ENV PHP_BUILD_DEPS \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
# libssl-dev/oldoldstable 1.0.1t-1
libssl-dev \
libxml2-dev

Expand All @@ -25,12 +33,15 @@ ENV PHP_RUNTIME_DEPS \
libpcre3 \
librecode0 \
libsqlite3-0 \
# libssl1.0.0/oldoldstable,now 1.0.1t-1
libssl1.0.0 \
libxml2 \
xz-utils

ENV BUILD_TOOLS \
autoconf \
bison \
bisonc++ \
ca-certificates \
curl \
dpkg-dev \
Expand Down Expand Up @@ -81,51 +92,52 @@ RUN set -eux \
| awk -F'/' '{print $2}' \
| xargs -n1 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys

# As this is the Jessie Version already, we can skip custom OpenSSL installation

###
### Build OpenSSL
###
RUN set -eux \
# Install Dependencies
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get install -y --no-install-recommends --no-install-suggests \
${BUILD_TOOLS_32}; \
fi \
# Fetch OpenSSL
&& cd /tmp \
&& mkdir openssl \
&& update-ca-certificates \
&& curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
&& curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc \
&& tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
&& cd /tmp/openssl \
# Build OpenSSL
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
setarch i386 ./config -m32; \
else \
./config; \
fi \
&& make depend \
&& make -j"$(nproc)" \
&& make install \
# Cleanup
&& rm -rf /tmp/* \
# Ensure libs are linked to correct architecture directory
&& debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
&& mkdir -p "/usr/local/ssl/lib/${debMultiarch}" \
&& ln -s /usr/local/ssl/lib/* "/usr/local/ssl/lib/${debMultiarch}/" \
# Remove Dependencies
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS_32}; \
fi \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
#RUN set -eux \
## Install Dependencies
# && apt-get update \
# && apt-get install -y --no-install-recommends --no-install-suggests \
# ${BUILD_TOOLS} \
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# apt-get install -y --no-install-recommends --no-install-suggests \
# ${BUILD_TOOLS_32}; \
# fi \
## Fetch OpenSSL
# && cd /tmp \
# && mkdir openssl \
# && update-ca-certificates \
# && curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
# && curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc \
# && tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
# && cd /tmp/openssl \
## Build OpenSSL
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# setarch i386 ./config -m32; \
# else \
# ./config; \
# fi \
# && make depend \
# && make -j"$(nproc)" \
# && make install \
## Cleanup
# && rm -rf /tmp/* \
## Ensure libs are linked to correct architecture directory
# && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
# && mkdir -p "/usr/local/ssl/lib/${debMultiarch}" \
# && ln -s /usr/local/ssl/lib/* "/usr/local/ssl/lib/${debMultiarch}/" \
## Remove Dependencies
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
# ${BUILD_TOOLS_32}; \
# fi \
# && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
# ${BUILD_TOOLS} \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*


###
Expand All @@ -141,6 +153,8 @@ RUN set -eux \
###
COPY data/docker-php-source /usr/local/bin/
COPY data/php/php-${PHP_VERSION}.tar.xz /usr/src/php.tar.xz
# Fix config.guess for PHP itself (adds 'aarch64' [arm64] architecture)
# This file has been manually fixed
COPY data/php/config.guess.patched /usr/src/config.guess


Expand Down Expand Up @@ -185,6 +199,7 @@ RUN set -eux \
--disable-cgi \
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
--with-openssl-dir=/usr \
\
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
Expand All @@ -203,7 +218,7 @@ RUN set -eux \
--with-sqlite3=/usr \
\
--with-curl \
--with-openssl=/usr/local/ssl \
--with-openssl \
--with-readline \
--with-recode \
--with-zlib \
Expand All @@ -214,13 +229,13 @@ RUN set -eux \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& docker-php-source delete \
# Remove Dependencies
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${PHP_BUILD_DEPS} \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS_32}; \
fi \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${PHP_BUILD_DEPS} \
${BUILD_TOOLS} \
# Install Run-time requirements
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
Expand All @@ -229,6 +244,10 @@ RUN set -eux \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Fix config.guess for PHP modules (adds 'aarch64' [arm64] architecture)
# The config.guess has been copied from PHP 5.5
COPY data/php/usr-local-lib-php-build-config.guess /usr/local/lib/php/build/config.guess
COPY data/php/usr-local-lib-php-build-config.sub /usr/local/lib/php/build/config.sub

COPY data/docker-php-* /usr/local/bin/

Expand Down
Loading

0 comments on commit 53bb206

Please sign in to comment.