Skip to content

Commit

Permalink
Merge pull request #2 from devilbox/release-0.2
Browse files Browse the repository at this point in the history
Multi build
  • Loading branch information
cytopia authored Mar 19, 2022
2 parents 754e1f7 + 0ae98bb commit ee6f3ee
Show file tree
Hide file tree
Showing 20 changed files with 666 additions and 156 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.4"],
"FLAVOUR": ["jessie", "stretch", "latest"],
"ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
}
]
Expand Down
150 changes: 0 additions & 150 deletions Dockerfile

This file was deleted.

198 changes: 198 additions & 0 deletions Dockerfiles/Dockerfile.jessie
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
FROM debian:jessie-slim
MAINTAINER "cytopia" <[email protected]>


ENV PHP_VERSION=5.4.45
ENV PHP_INI_DIR=/usr/local/etc/php

ENV OPENSSL_VERSION=1.0.1t

ENV PHP_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

ENV PHP_RUNTIME_DEPS \
libmysqlclient18 \
libpcre3 \
librecode0 \
libsqlite3-0 \
libssl1.0.0 \
libxml2 \
xz-utils

ENV BUILD_TOOLS \
autoconf \
ca-certificates \
curl \
dpkg-dev \
file \
flex \
g++ \
gcc \
libc-dev \
make \
patch \
pkg-config \
re2c \
xz-utils

ENV BUILD_TOOLS_32 \
g++-multilib \
gcc-multilib

ENV RUNTIME_TOOLS \
ca-certificates \
curl


###
### 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/*


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


###
### Copy PHP, scripts and patches
###
COPY data/docker-php-source /usr/local/bin/
COPY data/php/php-${PHP_VERSION}.tar.xz /usr/src/php.tar.xz
COPY data/php/config.guess.patched /usr/src/config.guess


###
### Build PHP
###
RUN set -eux \
# Install Dependencies
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${PHP_BUILD_DEPS} \
${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 \
# Extract PHP
&& tar -Jxf /usr/src/php.tar.xz -C "/usr/src/php" --strip-components=1 \
# Patch config.guess
&& mv -f /usr/src/config.guess /usr/src/php/config.guess \
# Remove old tar.xz
&& rm /usr/src/php.tar.xz \
# Create php.tar.xz
&& cd /usr/src \
&& tar -cJf php.tar.xz php \
# Setup Requirements
&& 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 \
# Build PHP
&& ./configure \
--with-libdir="/lib/${debMultiarch}/" \
--with-config-file-path="${PHP_INI_DIR}" \
--with-config-file-scan-dir="${PHP_INI_DIR}/conf.d" \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--disable-cgi \
--enable-mysqlnd \
--with-mysql \
--with-curl \
--with-openssl=/usr/local/ssl \
--with-readline \
--with-recode \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
# Cleanup
&& make clean \
&& { 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 \
# Install Run-time requirements
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${PHP_RUNTIME_DEPS} \
${RUNTIME_TOOLS} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*


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

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

EXPOSE 9000
CMD ["php-fpm"]
Loading

0 comments on commit ee6f3ee

Please sign in to comment.