Skip to content

Commit 6d6fd3c

Browse files
feat: add php 7.1.33
1 parent 32553ef commit 6d6fd3c

File tree

7 files changed

+5659
-0
lines changed

7 files changed

+5659
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build PHP 7.1.33 Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
php70Version:
7+
description: 'PHP 7.1 Version'
8+
default: '7.1.33'
9+
required: true
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Login to Docker Hub
25+
uses: docker/login-action@v3
26+
with:
27+
username: ${{ secrets.DOCKERHUB_USERNAME }}
28+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
29+
30+
- name: Build PHP-7.1 and Push
31+
uses: docker/build-push-action@v5
32+
with:
33+
context: php/7.1.33
34+
file: php/7.1.33/Dockerfile
35+
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
36+
push: true
37+
build-args:
38+
PHP_VERSION=${{ github.event.inputs.php70Version }}
39+
tags: |
40+
1panel/php:${{ github.event.inputs.php70Version }}-fpm
41+
cache-from: type=gha
42+
cache-to: type=gha,mode=max

php/7.1.33/Dockerfile

Lines changed: 287 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
#
2+
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3+
#
4+
# PLEASE DO NOT EDIT IT DIRECTLY.
5+
#
6+
FROM php:7.1.33-fpm AS php-source
7+
8+
FROM debian:bullseye-slim
9+
10+
# prevent Debian's PHP packages from being installed
11+
# https://github.com/docker-library/php/pull/542
12+
RUN set -eux; \
13+
{ \
14+
echo 'Package: php*'; \
15+
echo 'Pin: release *'; \
16+
echo 'Pin-Priority: -1'; \
17+
} > /etc/apt/preferences.d/no-debian-php
18+
19+
# dependencies required for running "phpize"
20+
# (see persistent deps below)
21+
ENV PHPIZE_DEPS \
22+
autoconf \
23+
dpkg-dev \
24+
file \
25+
g++ \
26+
gcc \
27+
libc-dev \
28+
make \
29+
pkg-config \
30+
re2c
31+
32+
# persistent / runtime deps
33+
RUN set -eux; \
34+
apt-get update; \
35+
apt-get install -y --no-install-recommends \
36+
$PHPIZE_DEPS \
37+
ca-certificates \
38+
curl \
39+
xz-utils \
40+
; \
41+
rm -rf /var/lib/apt/lists/*
42+
43+
ENV PHP_INI_DIR /usr/local/etc/php
44+
RUN set -eux; \
45+
mkdir -p "$PHP_INI_DIR/conf.d"; \
46+
# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743)
47+
[ ! -d /var/www/html ]; \
48+
mkdir -p /var/www/html; \
49+
chown www-data:www-data /var/www/html; \
50+
chmod 777 /var/www/html
51+
52+
##<autogenerated>##
53+
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi
54+
##</autogenerated>##
55+
56+
# Apply stack smash protection to functions using local buffers and alloca()
57+
# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
58+
# Enable optimization (-O2)
59+
# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
60+
# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
61+
# https://github.com/docker-library/php/issues/272
62+
ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2"
63+
ENV PHP_CPPFLAGS="$PHP_CFLAGS"
64+
ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
65+
66+
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0 528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 1729F83938DA44E27BA0F4D3DBDB397470D12172
67+
68+
ENV PHP_VERSION 7.1.33
69+
ENV PHP_URL="https://www.php.net/get/php-7.1.33.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-7.1.33.tar.xz.asc/from/this/mirror"
70+
#ENV PHP_SHA256="7f38b5bdaae3184d325a8c70e86c010afcc33651d15faafe277a0db6d2ea2741" PHP_MD5=""
71+
72+
RUN set -eux; \
73+
\
74+
savedAptMark="$(apt-mark showmanual)"; \
75+
apt-get update; \
76+
apt-get install -y --no-install-recommends gnupg dirmngr; \
77+
rm -rf /var/lib/apt/lists/*; \
78+
\
79+
mkdir -p /usr/src; \
80+
cd /usr/src; \
81+
\
82+
curl -fsSL -o php.tar.xz "$PHP_URL"; \
83+
\
84+
# if [ -n "$PHP_SHA256" ]; then \
85+
# echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
86+
# fi; \
87+
# if [ -n "$PHP_MD5" ]; then \
88+
# echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \
89+
# fi; \
90+
# \
91+
# if [ -n "$PHP_ASC_URL" ]; then \
92+
# curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
93+
# export GNUPGHOME="$(mktemp -d)"; \
94+
# for key in $GPG_KEYS; do \
95+
# gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
96+
# done; \
97+
# gpg --batch --verify php.tar.xz.asc php.tar.xz; \
98+
# gpgconf --kill all; \
99+
# rm -rf "$GNUPGHOME"; \
100+
# fi; \
101+
# \
102+
apt-mark auto '.*' > /dev/null; \
103+
apt-mark manual $savedAptMark > /dev/null; \
104+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
105+
106+
#COPY docker-php-source /usr/local/bin/
107+
108+
COPY --from=php-source /usr/local/bin/docker-php-source /usr/local/bin/
109+
110+
RUN set -eux; \
111+
\
112+
savedAptMark="$(apt-mark showmanual)"; \
113+
apt-get update; \
114+
apt-get install -y --no-install-recommends \
115+
libcurl4-openssl-dev \
116+
libedit-dev \
117+
libsqlite3-dev \
118+
libssl-dev \
119+
libxml2-dev \
120+
zlib1g-dev \
121+
${PHP_EXTRA_BUILD_DEPS:-} \
122+
; \
123+
rm -rf /var/lib/apt/lists/*; \
124+
\
125+
export \
126+
CFLAGS="$PHP_CFLAGS" \
127+
CPPFLAGS="$PHP_CPPFLAGS" \
128+
LDFLAGS="$PHP_LDFLAGS" \
129+
; \
130+
docker-php-source extract; \
131+
cd /usr/src/php; \
132+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
133+
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
134+
# https://bugs.php.net/bug.php?id=74125
135+
if [ ! -d /usr/include/curl ]; then \
136+
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
137+
fi; \
138+
./configure \
139+
--build="$gnuArch" \
140+
--with-config-file-path="$PHP_INI_DIR" \
141+
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
142+
\
143+
# make sure invalid --configure-flags are fatal errors intead of just warnings
144+
--enable-option-checking=fatal \
145+
\
146+
# https://github.com/docker-library/php/issues/439
147+
--with-mhash \
148+
\
149+
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
150+
--enable-ftp \
151+
# --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)
152+
--enable-mbstring \
153+
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
154+
--enable-mysqlnd \
155+
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
156+
--with-pdo-sqlite=/usr \
157+
--with-sqlite3=/usr \
158+
\
159+
--with-curl \
160+
--with-libedit \
161+
--with-openssl \
162+
--with-zlib \
163+
\
164+
# bundled pcre does not support JIT on s390x
165+
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
166+
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
167+
--with-libdir="lib/$debMultiarch" \
168+
\
169+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
170+
; \
171+
make -j "$(nproc)"; \
172+
find -type f -name '*.a' -delete; \
173+
make install; \
174+
find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \
175+
make clean; \
176+
\
177+
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
178+
cp -v php.ini-* "$PHP_INI_DIR/"; \
179+
\
180+
cd /; \
181+
docker-php-source delete; \
182+
\
183+
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
184+
apt-mark auto '.*' > /dev/null; \
185+
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
186+
find /usr/local -type f -executable -exec ldd '{}' ';' \
187+
| awk '/=>/ { print $(NF-1) }' \
188+
| sort -u \
189+
| xargs -r dpkg-query --search \
190+
| cut -d: -f1 \
191+
| sort -u \
192+
| xargs -r apt-mark manual \
193+
; \
194+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
195+
\
196+
# update pecl channel definitions https://github.com/docker-library/php/issues/443
197+
pecl update-channels; \
198+
rm -rf /tmp/pear ~/.pearrc; \
199+
# smoke test
200+
php --version
201+
202+
#COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
203+
204+
COPY --from=php-source /usr/local/bin/docker-php-ext-* /usr/local/bin/
205+
COPY --from=php-source /usr/local/bin/docker-php-entrypoint /usr/local/bin/
206+
207+
# temporary "freetype-config" workaround for https://github.com/docker-library/php/issues/865 (https://bugs.php.net/bug.php?id=76324)
208+
RUN { echo '#!/bin/sh'; echo 'exec pkg-config "$@" freetype2'; } > /usr/local/bin/freetype-config && chmod +x /usr/local/bin/freetype-config
209+
210+
ENTRYPOINT ["docker-php-entrypoint"]
211+
##<autogenerated>##
212+
WORKDIR /var/www/html
213+
214+
RUN set -eux; \
215+
cd /usr/local/etc; \
216+
if [ -d php-fpm.d ]; then \
217+
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
218+
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
219+
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
220+
else \
221+
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
222+
mkdir php-fpm.d; \
223+
cp php-fpm.conf.default php-fpm.d/www.conf; \
224+
{ \
225+
echo '[global]'; \
226+
echo 'include=etc/php-fpm.d/*.conf'; \
227+
} | tee php-fpm.conf; \
228+
fi; \
229+
{ \
230+
echo '[global]'; \
231+
echo 'error_log = /proc/self/fd/2'; \
232+
echo; \
233+
echo '[www]'; \
234+
echo '; if we send this to /proc/self/fd/1, it never appears'; \
235+
echo 'access.log = /proc/self/fd/2'; \
236+
echo; \
237+
echo 'clear_env = no'; \
238+
echo; \
239+
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
240+
echo 'catch_workers_output = yes'; \
241+
} | tee php-fpm.d/docker.conf; \
242+
{ \
243+
echo '[global]'; \
244+
echo 'daemonize = no'; \
245+
echo; \
246+
echo '[www]'; \
247+
echo 'listen = 9000'; \
248+
} | tee php-fpm.d/zz-docker.conf
249+
250+
COPY ./data/supervisor-4.2.5.tar.gz /tmp/
251+
COPY ./data/php-fpm.ini /etc/supervisor.d/php-fpm.ini
252+
COPY ./data/supervisord.conf /etc/supervisord.conf
253+
COPY ./data/install-php-extensions /usr/local/bin/
254+
COPY ./data/composer /usr/bin/composer
255+
256+
RUN apt-get update && \
257+
apt-get install -y python3 python3-pip git wget&& \
258+
rm -rf /var/lib/apt/lists/*
259+
260+
RUN cd /tmp && \
261+
tar -xzvf supervisor-4.2.5.tar.gz && \
262+
cd supervisor-4.2.5 && \
263+
python3 setup.py install && \
264+
mkdir -p /var/log/supervisor /etc/supervisor/conf.d
265+
266+
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
267+
&& php /tmp/composer-setup.php --install-dir=/tmp \
268+
&& mv /tmp/composer.phar /usr/bin/composer \
269+
&& chmod +x /usr/bin/composer \
270+
&& rm -rf /tmp/composer-setup.php
271+
272+
RUN chmod uga+x /usr/local/bin/install-php-extensions
273+
274+
ENV COMPOSER_HOME=/tmp/.composer
275+
276+
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
277+
278+
ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisord.conf"]
279+
280+
# Override stop signal to stop process gracefully
281+
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
282+
#STOPSIGNAL SIGQUIT
283+
284+
EXPOSE 9000
285+
WORKDIR /www
286+
#CMD ["php-fpm"]
287+
##</autogenerated>##

php/7.1.33/data/composer

2.86 MB
Binary file not shown.

0 commit comments

Comments
 (0)