Skip to content

Commit 0491d9e

Browse files
committed
feat: add php 7.4
1 parent 2d980d9 commit 0491d9e

21 files changed

Lines changed: 488 additions & 0 deletions

File tree

.github/workflows/7.4.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# NOTE: This file was generated via generate.sh. Don't edit it directly
2+
3+
name: 'PHP 7.4'
4+
5+
on:
6+
pull_request:
7+
paths:
8+
- 7.4/**
9+
push:
10+
paths:
11+
- 7.4/**
12+
13+
defaults:
14+
run:
15+
shell: 'bash -Eeuo pipefail -x {0}'
16+
17+
jobs:
18+
verify-templating:
19+
name: Verify templating
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Generate
24+
run: make all
25+
- name: Check Git status
26+
run: |
27+
test -z "$(git status --short)"
28+
29+
docker:
30+
name: ${{ matrix.target }}
31+
runs-on: ubuntu-latest
32+
needs:
33+
- verify-templating
34+
strategy:
35+
matrix:
36+
target:
37+
[
38+
"7_4_33-cli-alpine3_16",
39+
"7_4_33-fpm-alpine3_16",
40+
"7_4_33-nginx-alpine3_16",
41+
]
42+
env:
43+
DOCKER_HUB_PUSH: ${{ (secrets.DOCKER_HUB_USERNAME && secrets.DOCKER_HUB_TOKEN) && 'true' || 'false' }}
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v2
49+
with:
50+
platforms: arm,arm64
51+
- name: Set up buildx
52+
uses: docker/setup-buildx-action@v2
53+
- name: Login to Docker Hub
54+
uses: docker/login-action@v2
55+
with:
56+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
57+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
58+
if: ${{ env.DOCKER_HUB_PUSH == 'true' }}
59+
- name: Login to GitHub Container Registry
60+
uses: docker/login-action@v2
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.repository_owner }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
- name: Build and push to GitHub Container Registry
66+
uses: docker/bake-action@v2
67+
env:
68+
REGISTRY: ghcr.io
69+
REPO: ${{ github.repository_owner }}/php
70+
with:
71+
targets: ${{ matrix.target }}
72+
set: |
73+
*.platform=linux/amd64,linux/arm,linux/arm64
74+
push: ${{ github.event_name == 'push' }}
75+
- name: Build and push to DockerHub
76+
uses: docker/bake-action@v2
77+
with:
78+
targets: ${{ matrix.target }}
79+
set: |
80+
*.platform=linux/amd64,linux/arm,linux/arm64
81+
push: ${{ github.event_name == 'push' }}
82+
if: ${{ env.DOCKER_HUB_PUSH == 'true' }}

7.4/alpine3.16/cli/Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# NOTE: This file was generated via generate.sh. Don't edit it directly
2+
3+
FROM php:7.4.33-cli-alpine3.16
4+
5+
ENV RUN_DEPS \
6+
zlib \
7+
libzip \
8+
libpng \
9+
libjpeg-turbo \
10+
postgresql-libs
11+
12+
ENV BUILD_DEPS \
13+
zlib-dev \
14+
libzip-dev \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
postgresql-dev
18+
19+
ENV PHP_EXTENSIONS \
20+
opcache \
21+
zip \
22+
gd \
23+
bcmath \
24+
mysqli \
25+
pdo_mysql \
26+
pgsql \
27+
pdo_pgsql
28+
29+
ENV PECL_EXTENSIONS \
30+
redis
31+
32+
RUN apk add --no-cache --virtual .build-deps $BUILD_DEPS \
33+
&& docker-php-ext-configure gd --with-jpeg \
34+
&& pecl install $PECL_EXTENSIONS \
35+
&& docker-php-ext-install -j "$(nproc)" $PHP_EXTENSIONS \
36+
&& docker-php-ext-enable $PECL_EXTENSIONS \
37+
&& apk del .build-deps
38+
39+
RUN apk add --no-cache --virtual .run-deps $RUN_DEPS
40+
41+
RUN mv /usr/local/bin/docker-php-entrypoint /usr/local/bin/docker-php-entrypoint-base
42+
43+
COPY rootfs /
44+
45+
# For backward compatibility
46+
RUN ln -s /usr/local/bin/docker-php-entrypoint /usr/local/bin/php-cli-entrypoint
47+
48+
ENTRYPOINT [ "docker-php-entrypoint" ]
49+
50+
CMD [ "php", "-a" ]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
write_env_config() {
6+
prefix=$1
7+
output=$2
8+
9+
env | grep -E "^$prefix\..+=.+" | while IFS='=' read -r config_name config_value; do
10+
echo "${config_name#*.} = $config_value" >> $output
11+
done
12+
}
13+
14+
write_env_config PHP $PHP_INI_DIR/conf.d/zz-docker-env.ini
15+
16+
exec docker-php-entrypoint-base "$@"

7.4/alpine3.16/fpm/Dockerfile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# NOTE: This file was generated via generate.sh. Don't edit it directly
2+
3+
FROM php:7.4.33-fpm-alpine3.16
4+
5+
ENV RUN_DEPS \
6+
zlib \
7+
libzip \
8+
libpng \
9+
libjpeg-turbo \
10+
postgresql-libs
11+
12+
ENV BUILD_DEPS \
13+
zlib-dev \
14+
libzip-dev \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
postgresql-dev
18+
19+
ENV PHP_EXTENSIONS \
20+
opcache \
21+
zip \
22+
gd \
23+
bcmath \
24+
mysqli \
25+
pdo_mysql \
26+
pgsql \
27+
pdo_pgsql
28+
29+
ENV PECL_EXTENSIONS \
30+
redis
31+
32+
RUN apk add --no-cache --virtual .build-deps $BUILD_DEPS \
33+
&& docker-php-ext-configure gd --with-jpeg \
34+
&& pecl install $PECL_EXTENSIONS \
35+
&& docker-php-ext-install -j "$(nproc)" $PHP_EXTENSIONS \
36+
&& docker-php-ext-enable $PECL_EXTENSIONS \
37+
&& apk del .build-deps
38+
39+
RUN apk add --no-cache --virtual .run-deps $RUN_DEPS
40+
41+
RUN mv /usr/local/bin/docker-php-entrypoint /usr/local/bin/docker-php-entrypoint-base
42+
43+
COPY rootfs /
44+
45+
RUN set -x \
46+
&& addgroup -g 101 -S nginx \
47+
&& adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx
48+
49+
RUN apk add --no-cache fcgi
50+
51+
# For backward compatibility
52+
RUN ln -s /usr/local/bin/docker-php-entrypoint /usr/local/bin/php-fpm-entrypoint
53+
54+
ENTRYPOINT [ "docker-php-entrypoint" ]
55+
56+
CMD [ "php-fpm" ]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
write_env_config() {
6+
prefix=$1
7+
output=$2
8+
9+
env | grep -E "^$prefix\..+=.+" | while IFS='=' read -r config_name config_value; do
10+
echo "${config_name#*.} = $config_value" >> $output
11+
done
12+
}
13+
14+
write_env_config PHP $PHP_INI_DIR/conf.d/zz-docker-env.ini
15+
write_env_config PHP_FPM /usr/local/etc/php-fpm.d/zz-docker.conf
16+
17+
exec docker-php-entrypoint-base "$@"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export SCRIPT_NAME="/ping"
2+
export SCRIPT_FILENAME="/ping"
3+
export REQUEST_METHOD="GET"
4+
5+
ping_response=$(cgi-fcgi -bind -connect localhost:9000 2> /dev/null | tail -n 1)
6+
7+
if [ "$ping_response" != "pong" ]; then
8+
exit 1
9+
fi
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[global]
2+
daemonize = no
3+
4+
[www]
5+
listen = 9000
6+
7+
ping.path = /ping
8+
ping.response = pong
9+
10+
access.format = "%R - %t \"%m %r %{HTTP_X_URI}e\" %s %{mili}d %{kilo}M %C%%"

7.4/alpine3.16/nginx/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# NOTE: This file was generated via generate.sh. Don't edit it directly
2+
3+
FROM php:7.4.33-fpm-alpine3.16
4+
5+
ENV RUN_DEPS \
6+
zlib \
7+
libzip \
8+
libpng \
9+
libjpeg-turbo \
10+
postgresql-libs
11+
12+
ENV BUILD_DEPS \
13+
zlib-dev \
14+
libzip-dev \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
postgresql-dev
18+
19+
ENV PHP_EXTENSIONS \
20+
opcache \
21+
zip \
22+
gd \
23+
bcmath \
24+
mysqli \
25+
pdo_mysql \
26+
pgsql \
27+
pdo_pgsql
28+
29+
ENV PECL_EXTENSIONS \
30+
redis
31+
32+
RUN apk add --no-cache --virtual .build-deps $BUILD_DEPS \
33+
&& docker-php-ext-configure gd --with-jpeg \
34+
&& pecl install $PECL_EXTENSIONS \
35+
&& docker-php-ext-install -j "$(nproc)" $PHP_EXTENSIONS \
36+
&& docker-php-ext-enable $PECL_EXTENSIONS \
37+
&& apk del .build-deps
38+
39+
RUN apk add --no-cache --virtual .run-deps $RUN_DEPS
40+
41+
RUN mv /usr/local/bin/docker-php-entrypoint /usr/local/bin/docker-php-entrypoint-base
42+
43+
COPY rootfs /
44+
45+
RUN set -x \
46+
&& addgroup -g 101 -S nginx \
47+
&& adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -g nginx -G www-data nginx
48+
49+
RUN apk add --no-cache nginx gettext
50+
51+
COPY --from=crazymax/alpine-s6-dist:3.15-3.0.0.2 / /
52+
53+
RUN mkdir -p /run/nginx /run/php \
54+
&& ln -sf /dev/stdout /var/log/nginx/access.log \
55+
&& ln -sf /dev/stderr /var/log/nginx/error.log
56+
57+
ENV DOCUMENT_ROOT=/var/www/html
58+
59+
EXPOSE 80 443
60+
61+
ENTRYPOINT [ "docker-php-entrypoint" ]
62+
63+
CMD [ "/init", "nginx", "-g", "daemon off;" ]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
user nginx;
3+
worker_processes auto;
4+
5+
error_log /var/log/nginx/error.log notice;
6+
pid /var/run/nginx.pid;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17+
'$status $body_bytes_sent "$http_referer" '
18+
'"$http_user_agent" "$http_x_forwarded_for"';
19+
20+
access_log /var/log/nginx/access.log main;
21+
22+
sendfile on;
23+
#tcp_nopush on;
24+
25+
keepalive_timeout 65;
26+
27+
#gzip on;
28+
29+
include /etc/nginx/conf.d/*.conf;
30+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
server {
2+
listen 80;
3+
4+
root ${DOCUMENT_ROOT};
5+
index index.html index.htm index.php;
6+
7+
location / {
8+
try_files $uri $uri/ /index.php?$query_string;
9+
}
10+
11+
location ~ \.php {
12+
fastcgi_pass unix:/run/php/php-fpm.sock;
13+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
14+
include fastcgi_params;
15+
internal;
16+
}
17+
${NGINX_CONF_SNIPPET}
18+
}

0 commit comments

Comments
 (0)