Skip to content

Commit 14967ad

Browse files
committed
Add PHP 8.4
1 parent c61a82a commit 14967ad

File tree

7 files changed

+399
-5
lines changed

7 files changed

+399
-5
lines changed

Makefile

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
NAME = skilldlabs/php
2-
TAGS ?= 81 81-fpm 81-unit 82 82-fpm 82-unit 83 83-fpm 83-unit
2+
TAGS ?= 81 81-fpm 81-unit 82 82-fpm 82-unit 83 83-fpm 83-unit 84 84-fpm 84-unit
33

44
COMPOSER_HASH ?= dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6
55
DRUSH_VERSION ?= 8.4.12
66
DOCKER_BUILDKIT ?= 1
7-
PLATFORM ?= linux/amd64
7+
PLATFORM ?= linux/amd64,linux/arm64
88

9-
.PHONY: all build push
9+
.PHONY: all build push prepare
1010

1111
all: build push
1212

1313
build:
1414
@echo "Building images for tags: $(TAGS)"
1515
set -e; for i in $(TAGS); do printf "\nBuilding $(NAME):$$i \n\n"; cd php$$i; \
16-
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) docker build -t $(NAME):$$i \
16+
docker buildx build -t $(NAME):$$i \
1717
--platform $(PLATFORM) \
18-
--no-cache --progress=plain \
18+
--no-cache --progress=plain --push \
1919
--build-arg COMPOSER_HASH=$(COMPOSER_HASH) \
2020
--build-arg DRUSH_VERSION=$(DRUSH_VERSION) \
2121
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
@@ -28,3 +28,7 @@ push:
2828

2929
unit:
3030
make -C unit-php-builder/dev build
31+
32+
prepare:
33+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
34+
docker buildx create --use

php84-fpm/Dockerfile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM skilldlabs/php:84
2+
3+
ARG BUILD_DATE
4+
ARG VCS_REF
5+
6+
LABEL org.label-schema.build-date=$BUILD_DATE \
7+
org.label-schema.vcs-ref=$VCS_REF \
8+
org.label-schema.schema-version="1.0" \
9+
org.label-schema.name="docker-php" \
10+
org.label-schema.description="PHP-FPM 8.4 Alpinelinux for Drupal - git, composer, drush 8, sqlite, patch" \
11+
org.label-schema.vcs-url="https://github.com/skilld-labs/docker-php" \
12+
maintainer="Andy Postnikov <[email protected]>"
13+
14+
RUN set -e \
15+
&& mkdir -p /var/www \
16+
&& addgroup -g 1000 -S web-group \
17+
&& adduser -u 1000 -D -S -G web-group web-user \
18+
&& mkdir -p /var/log/php84 && chown 1000:1000 /var/log/php84 \
19+
&& apk add --no-cache \
20+
php84-fpm
21+
22+
COPY php-fpm.conf /etc/php84/
23+
24+
#USER web-user
25+
WORKDIR /var/www/html
26+
VOLUME /var/www/html
27+
28+
EXPOSE 9000
29+
30+
CMD ["php-fpm84", "-F"]

php84-fpm/php-fpm.conf

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[global]
2+
error_log = /proc/self/fd/2
3+
log_level = notice
4+
daemonize = no
5+
6+
[app]
7+
user = web-user
8+
group = web-group
9+
listen = [::]:9000
10+
access.log = /proc/self/fd/2
11+
catch_workers_output = yes
12+
clear_env = no
13+
security.limit_extensions = .php
14+
15+
pm = ondemand
16+
pm.max_children = 4
17+
pm.max_requests = 100
18+
pm.process_idle_timeout = 30
19+
20+
php_value[memory_limit] = 512M

php84-unit/Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ARG PHPV=84
2+
3+
FROM skilldlabs/php:${PHPV}
4+
ARG PHPV
5+
ARG BUILD_DATE
6+
ARG VCS_REF
7+
8+
LABEL org.label-schema.build-date=$BUILD_DATE \
9+
org.label-schema.vcs-ref=$VCS_REF \
10+
org.label-schema.schema-version="1.0" \
11+
org.label-schema.name="docker-php" \
12+
org.label-schema.description="Unit PHP 8.4 Alpinelinux for Drupal - git, composer, drush 8, sqlite, patch" \
13+
org.label-schema.vcs-url="https://github.com/skilld-labs/docker-php" \
14+
maintainer="Andy Postnikov <[email protected]>"
15+
16+
COPY conf.json /var/lib/unit/
17+
18+
WORKDIR /var/www/html
19+
VOLUME /var/www/html
20+
21+
EXPOSE 80
22+
23+
RUN set -e && \
24+
apk add --no-cache unit-php${PHPV} && \
25+
mkdir -p /var/www/html/web && \
26+
addgroup -g 1000 -S web-group && \
27+
adduser -u 1000 -D -S -G web-group web-user
28+
29+
CMD ["unitd", "--no-daemon", "--user", "web-user", "--group", "web-group", "--log", "/dev/stdout"]

php84-unit/conf.json

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"access_log": "/dev/stdout",
3+
"listeners": {
4+
"*:80": {
5+
"pass": "routes/main"
6+
}
7+
},
8+
9+
"routes": {
10+
"main": [
11+
{
12+
"match": {
13+
"uri": [
14+
"!*/.well-known/*",
15+
"/vendor/*",
16+
"/core/profiles/demo_umami/modules/demo_umami_content/default_content/*",
17+
"*.engine",
18+
"*.inc",
19+
"*.install",
20+
"*.make",
21+
"*.module",
22+
"*.po",
23+
"*.profile",
24+
"*.sh",
25+
"*.theme",
26+
"*.tpl",
27+
"*.twig",
28+
"*.xtmpl",
29+
"*.yml",
30+
"*/.*",
31+
"*/Entries*",
32+
"*/Repository",
33+
"*/Root",
34+
"*/Tag",
35+
"*/Template",
36+
"*/composer.json",
37+
"*/composer.lock",
38+
"*/web.config",
39+
"*sql",
40+
"*.bak",
41+
"*.orig",
42+
"*.save",
43+
"*.swo",
44+
"*.swp",
45+
"*~"
46+
]
47+
},
48+
49+
"action": {
50+
"return": 404
51+
}
52+
},
53+
{
54+
"match": {
55+
"uri": [
56+
"/core/authorize.php",
57+
"/core/install.php",
58+
"/core/modules/statistics/statistics.php",
59+
"~^/core/modules/system/tests/https?\\.php",
60+
"/core/rebuild.php",
61+
"/update.php",
62+
"/update.php/*"
63+
]
64+
},
65+
66+
"action": {
67+
"pass": "applications/drupal/direct"
68+
}
69+
},
70+
{
71+
"match": {
72+
"uri": [
73+
"!/index.php*",
74+
"*.php"
75+
]
76+
},
77+
78+
"action": {
79+
"return": 404
80+
}
81+
},
82+
{
83+
"match": {
84+
"uri": [
85+
"~^.*css_[a-zA-Z0-9-_]+\\.css(?:\\?.*)?$",
86+
"~^.*js_[a-zA-Z0-9-_]+\\.js(?:\\?.*)?$"
87+
],
88+
89+
"headers": [
90+
{
91+
"Accept-Encoding": "*gzip*"
92+
}
93+
]
94+
},
95+
96+
"action": {
97+
"pass": "routes/assets_gz"
98+
}
99+
},
100+
{
101+
"action": {
102+
"share": "/var/www/html/web$uri",
103+
"fallback": {
104+
"pass": "applications/drupal/index"
105+
}
106+
}
107+
}
108+
],
109+
110+
"assets_gz": [
111+
{
112+
"action": {
113+
"share": "/var/www/html/web${uri}.gz",
114+
"response_headers": {
115+
"Content-Encoding": "gzip"
116+
},
117+
118+
"fallback": {
119+
"pass": "routes/assets"
120+
}
121+
}
122+
}
123+
],
124+
125+
"assets": [
126+
{
127+
"action": {
128+
"share": "/var/www/html/web${uri}",
129+
"fallback": {
130+
"pass": "applications/drupal/index"
131+
}
132+
}
133+
}
134+
]
135+
},
136+
137+
"applications": {
138+
"drupal": {
139+
"type": "php",
140+
"stdout": "/dev/stdout",
141+
"stderr": "/dev/stderr",
142+
"processes": {
143+
"max": 4,
144+
"spare": 2,
145+
"idle_timeout": 120
146+
},
147+
148+
"limits": {
149+
"timeout": 300,
150+
"requests": 1500
151+
},
152+
153+
"options": {
154+
"admin": {
155+
"memory_limit": "1G",
156+
"opcache.jit_buffer_size": "20M"
157+
}
158+
},
159+
160+
"targets": {
161+
"direct": {
162+
"root": "/var/www/html/web/"
163+
},
164+
165+
"index": {
166+
"root": "/var/www/html/web/",
167+
"script": "index.php"
168+
}
169+
}
170+
}
171+
}
172+
}

php84/Dockerfile

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
FROM alpine:edge
2+
3+
ARG COMPOSER_HASH
4+
ARG DRUSH_VERSION
5+
ARG BUILD_DATE
6+
ARG VCS_REF
7+
8+
LABEL org.label-schema.build-date=$BUILD_DATE \
9+
org.label-schema.vcs-ref=$VCS_REF \
10+
org.label-schema.schema-version="1.0" \
11+
org.label-schema.name="docker-php" \
12+
org.label-schema.description="PHP 8.4 Alpine for Drupal - git, composer, drush 8, sqlite, patch" \
13+
org.label-schema.vcs-url="https://github.com/skilld-labs/docker-php" \
14+
maintainer="Andy Postnikov <[email protected]>"
15+
16+
ENV PHPRUN_DEPS \
17+
curl \
18+
git \
19+
make \
20+
mariadb-client \
21+
openssh-client \
22+
patch \
23+
rsync \
24+
sqlite
25+
ENV PHP_CLI_SERVER_WORKERS 4
26+
27+
RUN set -e \
28+
&& apk --update upgrade \
29+
&& echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \
30+
&& apk add --upgrade \
31+
php84 \
32+
php84-pecl-apcu \
33+
php84-pecl-brotli \
34+
php84-pecl-igbinary \
35+
php84-pecl-uploadprogress \
36+
php84-pecl-xdebug \
37+
php84-bcmath \
38+
php84-ctype \
39+
php84-curl \
40+
php84-dom \
41+
php84-fileinfo \
42+
php84-gd \
43+
php84-gmp \
44+
php84-iconv \
45+
php84-mbstring \
46+
php84-opcache \
47+
php84-openssl \
48+
php84-pcntl \
49+
php84-pdo_mysql \
50+
php84-pdo_sqlite \
51+
php84-phar \
52+
php84-session \
53+
php84-simplexml \
54+
php84-sqlite3 \
55+
php84-tokenizer \
56+
php84-xml \
57+
php84-xmlreader \
58+
php84-xmlwriter \
59+
php84-zip \
60+
$PHPRUN_DEPS \
61+
&& ln -fs php84 /usr/bin/php \
62+
# build extra extensions
63+
# && apk add --virtual .php-build \
64+
# php84-dev php84-pear make gcc g++ \
65+
# && sed -ie 's/-n//g' /usr/bin/pecl83 \
66+
# && CFLAGS="-Os -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fvisibility=hidden -Wall -Wno-strict-aliasing" \
67+
# CPPFLAGS="$CFLAGS" LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" \
68+
# pecl83 install redis \
69+
# && echo 'extension=redis' > /etc/php84/conf.d/redis.ini \
70+
# && echo 'xhprof.output_dir=/tmp' >> /etc/php84/conf.d/xhprof.ini \
71+
# && strip /usr/lib/php84/modules/redis.so \
72+
# && wget https://github.com/xdebug/xdebug/archive/master.zip && unzip master.zip && rm master.zip \
73+
# && cd xdebug-master && phpize83 && ./configure --with-php-config=php-config83 \
74+
# && CFLAGS="-Os -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fvisibility=hidden -Wall -Wno-strict-aliasing" \
75+
# CPPFLAGS="$CFLAGS" LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" \
76+
# pecl83 install xdebug-3.0.0 \
77+
# make install \
78+
# && cd .. && rm -rf xdebug-master \
79+
# && echo ';zend_extension=xdebug' > /etc/php84/conf.d/xdebug.ini \
80+
# && strip /usr/lib/php84/modules/xdebug.so \
81+
# clean-up
82+
# && apk del --no-network .php-build \
83+
# && rm -fr /tmp/pear /usr/include /usr/share/pear \
84+
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
85+
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === getenv('COMPOSER_HASH')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
86+
&& php composer-setup.php \
87+
--install-dir=/usr/bin \
88+
--filename=composer2 \
89+
--2 \
90+
&& ln -s composer2 /usr/bin/composer \
91+
&& php -r "unlink('composer-setup.php');" \
92+
# && php -r "copy('https://github.com/drush-ops/drush/releases/download/$DRUSH_VERSION/drush.phar', '/usr/bin/drush');" \
93+
# && chmod +x /usr/bin/drush && /usr/bin/drush version && rm -fr /root/.drush \
94+
&& rm -fr /var/cache/apk/*
95+
96+
COPY --chmod=0755 drush.phar /usr/bin/drush
97+
98+
COPY php.ini /etc/php84/conf.d/xx-drupal.ini
99+
100+
WORKDIR /srv
101+
102+
CMD ["php", "-t", "/srv", "-S", "0.0.0.0:80"]

0 commit comments

Comments
 (0)