Skip to content

Commit ba82f98

Browse files
feat: update php 7.0.33 Dockerfile
1 parent 113fd4d commit ba82f98

File tree

9 files changed

+5649
-21
lines changed

9 files changed

+5649
-21
lines changed

.github/workflows/php7-release.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ on:
1919
description: 'PHP 7.1 Version'
2020
default: '7.1.33'
2121
required: true
22-
php70Version:
23-
description: 'PHP 7.0 Version'
24-
default: '7.0.33'
25-
required: true
2622

2723
jobs:
2824
docker:
@@ -98,17 +94,3 @@ jobs:
9894
1panel/php:${{ github.event.inputs.php71Version }}-fpm
9995
cache-from: type=gha
10096
cache-to: type=gha,mode=max
101-
102-
- name: Build PHP-7.0 and Push
103-
uses: docker/build-push-action@v5
104-
with:
105-
context: php/7
106-
file: php/7/Dockerfile
107-
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
108-
push: true
109-
build-args:
110-
PHP_VERSION=${{ github.event.inputs.php70Version }}
111-
tags: |
112-
1panel/php:${{ github.event.inputs.php70Version }}-fpm
113-
cache-from: type=gha
114-
cache-to: type=gha,mode=max
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build PHP 7.0.33 Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
php70Version:
7+
description: 'PHP 7.0 Version'
8+
default: '7.0.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.0 and Push
31+
uses: docker/build-push-action@v5
32+
with:
33+
context: php/7.0.33
34+
file: php/7.0.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.0.33/Dockerfile

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

php/7.0.33/data/composer

2.86 MB
Binary file not shown.

0 commit comments

Comments
 (0)