Skip to content

Commit

Permalink
Merge pull request #48 from devilbox/release-0.52
Browse files Browse the repository at this point in the history
Build multi-flavour
  • Loading branch information
cytopia authored Mar 18, 2022
2 parents 2f12b93 + ae091f9 commit 7b03c64
Show file tree
Hide file tree
Showing 25 changed files with 34,404 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# (2/2) Build
docker:
needs: [params]
uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
with:
enabled: true
can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/action_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# (2/2) Build
docker:
needs: [params]
uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
with:
enabled: true
can_deploy: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/action_schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# (2/2) Build
docker:
needs: [params]
uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
with:
enabled: true
can_deploy: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
{
"NAME": "PHP",
"VERSION": ["5.2"],
"FLAVOUR": ["jessie", "stretch", "latest"],
"ARCH": ["linux/amd64", "linux/386"]
}
]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:stretch
FROM debian:stretch-slim
MAINTAINER "cytopia" <cytopia@everythingcli.org>


Expand Down
178 changes: 178 additions & 0 deletions Dockerfiles/Dockerfile.jessie
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
FROM debian:jessie-slim
MAINTAINER "cytopia" <cytopia@everythingcli.org>


ENV PHP_VERSION 5.2.17
ENV PHP_INI_DIR /usr/local/etc/php

ENV BUILD_DEPS \
autoconf2.13 \
libbison-dev \
libcurl4-openssl-dev \
libfl-dev \
libmysqlclient-dev \
libpcre3-dev \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
patch


# Setup directories
RUN set -eux \
&& mkdir -p ${PHP_INI_DIR}/conf.d \
&& mkdir -p /usr/src/php


# persistent / runtime deps
RUN set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
curl \
libpcre3 \
librecode0 \
libmysqlclient18 \
libsqlite3-0 \
libxml2 \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*


# phpize deps
RUN set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
autoconf \
dpkg-dev \
file \
g++ \
gcc \
libc-dev \
make \
pkg-config \
re2c \
xz-utils \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get install -y --no-install-recommends --no-install-suggests \
g++-multilib \
gcc-multilib; \
fi \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*


# compile openssl, otherwise --with-openssl won't work
RUN set -eux \
&& OPENSSL_VERSION="1.0.2g" \
&& 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 \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
setarch i386 ./config -m32; \
else \
./config; \
fi \
&& make depend \
&& make -j"$(nproc)" \
&& make install \
&& rm -rf /tmp/openssl* \
# 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}/"


# php 5.2 needs older autoconf
RUN set -eux \
&& set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${BUILD_DEPS} \
&& rm -rf /var/lib/apt/lists/*


# Copy and apply patches to PHP
COPY data/php-${PHP_VERSION}*.patch /tmp/
RUN set -eux \
&& curl -sS -k -L --fail "http://museum.php.net/php5/php-${PHP_VERSION}.tar.gz" -o /usr/src/php.tar.gz \
\
# Extract artifacts
&& tar -xf /usr/src/php.tar.gz -C /usr/src/php --strip-components=1 \
# Apply patches
&& cd /usr/src/php \
&& patch -p1 < /tmp/php-${PHP_VERSION}-libxml2.patch \
&& patch -p1 < /tmp/php-${PHP_VERSION}-openssl.patch \
&& patch -p1 < /tmp/php-${PHP_VERSION}-fpm.patch \
&& (patch -p0 < /tmp/php-${PHP_VERSION}-curl.patch || true) \
# Create php.tar.xz
&& cd /usr/src \
&& tar -cJf php.tar.xz php \
# Clean-up
&& rm -rf php php.tar.gz \
&& rm -rf /tmp/php-*


COPY data/docker-php-source /usr/local/bin/
RUN set -eux \
&& apt update \
&& apt install --no-install-recommends --no-install-suggests \
flex -y \
&& docker-php-source extract \
&& cd /usr/src/php \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
\
# https://bugs.php.net/bug.php?id=74125
&& if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/${debMultiarch}/curl" /usr/local/include/curl; \
fi \
\
&& ./configure \
--host="${gnuArch}" \
--with-libdir="/lib/${debMultiarch}/" \
--with-config-file-path="${PHP_INI_DIR}" \
--with-config-file-scan-dir="${PHP_INI_DIR}/conf.d" \
--with-fpm-conf="/usr/local/etc/php-fpm.conf" \
\
--enable-fastcgi \
--enable-fpm \
--enable-force-cgi-redirect \
\
--enable-mbstring \
--enable-pdo \
--enable-soap \
\
--with-curl \
--with-mysql \
--with-mysqli \
--with-openssl=/usr/local/ssl \
--with-pdo-mysql \
--with-readline \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
&& php -v \
# Clean-up
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false ${BUILD_DEPS} \
&& make clean \
&& cd / \
&& docker-php-source delete


WORKDIR /var/www/html
COPY data/docker-php-* /usr/local/bin/
COPY data/php-fpm /usr/local/sbin/php-fpm
COPY data/php-fpm.conf /usr/local/etc/
COPY data/php.ini /usr/local/etc/php/php.ini


EXPOSE 9000
ENTRYPOINT ["php-fpm"]
1 change: 1 addition & 0 deletions Dockerfiles/Dockerfile.latest
Loading

0 comments on commit 7b03c64

Please sign in to comment.