Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9d75c43

Browse files
authored
Merge pull request #9 from amenophis/php83
Add PHP 8.3
2 parents 0b581e3 + 0760685 commit 9d75c43

File tree

9 files changed

+247
-0
lines changed

9 files changed

+247
-0
lines changed

‎8.3/base/Dockerfile‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM ubuntu:20.04
2+
3+
MAINTAINER Maksim Kotliar <kotlyar.maksim@gmail.com>
4+
5+
ENV LC_ALL=C.UTF-8
6+
7+
RUN apt-get update && \
8+
apt-get -y --no-install-recommends --no-install-suggests install software-properties-common && \
9+
add-apt-repository ppa:ondrej/php && \
10+
add-apt-repository ppa:ondrej/pkg-gearman && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
RUN apt-get update && \
14+
apt-get install -y --no-install-recommends --no-install-suggests nginx php8.3 php8.3-fpm php8.3-cli php8.3-common ca-certificates gettext && \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
# forward request and error logs to docker log collector
18+
RUN ln -sf /dev/stderr /var/log/nginx/access.log \
19+
&& ln -sf /dev/stderr /var/log/nginx/error.log \
20+
&& ln -sf /dev/stderr /var/log/php8.3-fpm.log \
21+
&& ln -sf /dev/stderr /var/log/php-fpm.log
22+
23+
RUN rm -f /etc/nginx/sites-enabled/*
24+
25+
COPY nginx.conf.tpl /nginx.conf.tpl
26+
COPY nginx_ssl.conf.tpl /nginx_ssl.conf.tpl
27+
COPY php-fpm.conf.tpl /php-fpm.conf.tpl
28+
COPY defaults.ini /etc/php/8.3/cli/conf.d/defaults.ini
29+
COPY defaults.ini /etc/php/8.3/fpm/conf.d/defaults.ini
30+
31+
RUN mkdir -p /run/php && touch /run/php/php8.3-fpm.sock && touch /run/php/php8.3-fpm.pid
32+
33+
COPY entrypoint.sh /entrypoint.sh
34+
RUN chmod 755 /entrypoint.sh
35+
36+
EXPOSE 80
37+
38+
CMD ["/entrypoint.sh"]

‎8.3/base/defaults.ini‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
date.timezone=UTC

‎8.3/base/entrypoint.sh‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
export NGINX_WEB_ROOT=${NGINX_WEB_ROOT:-'/var/www/html'}
4+
export NGINX_PHP_FALLBACK=${NGINX_PHP_FALLBACK:-'/index.php'}
5+
export NGINX_PHP_LOCATION=${NGINX_PHP_LOCATION:-'^/index\.php(/|$$)'}
6+
export NGINX_USER=${NGINX_USER:-'www-data'}
7+
export NGINX_CONF=${NGINX_CONF:-'/etc/nginx/nginx.conf'}
8+
export NGINX_SSL_PUBLIC_CERTIFICATE=${NGINX_SSL_PUBLIC_CERTIFICATE:-''}
9+
export NGINX_SSL_PRIVATE_CERTIFICATE=${NGINX_SSL_PRIVATE_CERTIFICATE:-''}
10+
11+
export PHP_SOCK_FILE=${PHP_SOCK_FILE:-'/run/php.sock'}
12+
export PHP_USER=${PHP_USER:-'www-data'}
13+
export PHP_GROUP=${PHP_GROUP:-'www-data'}
14+
export PHP_MODE=${PHP_MODE:-'0660'}
15+
export PHP_FPM_CONF=${PHP_FPM_CONF:-'/etc/php/7.3/fpm/php-fpm.conf'}
16+
17+
envsubst '${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /nginx.conf.tpl > $NGINX_CONF
18+
envsubst '${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /php-fpm.conf.tpl > $PHP_FPM_CONF
19+
20+
if [ ! -z "$NGINX_SSL_PUBLIC_CERTIFICATE" ]
21+
then
22+
envsubst '${NGINX_SSL_PUBLIC_CERTIFICATE} ${NGINX_SSL_PRIVATE_CERTIFICATE} ${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /nginx_ssl.conf.tpl > /etc/nginx/conf.d/nginx_ssl.conf
23+
fi
24+
25+
TRAPPED_SIGNAL=false
26+
27+
echo 'Starting NGINX';
28+
nginx -c $NGINX_CONF -g 'daemon off;' 2>&1 &
29+
NGINX_PID=$!
30+
31+
echo 'Starting PHP-FPM';
32+
php-fpm7.3 -R -F -c $PHP_FPM_CONF 2>&1 &
33+
PHP_FPM_PID=$!
34+
35+
trap "TRAPPED_SIGNAL=true; kill -15 $NGINX_PID; kill -15 $PHP_FPM_PID;" SIGTERM SIGINT
36+
37+
while :
38+
do
39+
kill -0 $NGINX_PID 2> /dev/null
40+
NGINX_STATUS=$?
41+
42+
kill -0 $PHP_FPM_PID 2> /dev/null
43+
PHP_FPM_STATUS=$?
44+
45+
if [ "$TRAPPED_SIGNAL" = "false" ]; then
46+
if [ $NGINX_STATUS -ne 0 ] || [ $PHP_FPM_STATUS -ne 0 ]; then
47+
if [ $NGINX_STATUS -eq 0 ]; then
48+
kill -15 $NGINX_PID;
49+
wait $NGINX_PID;
50+
fi
51+
if [ $PHP_FPM_STATUS -eq 0 ]; then
52+
kill -15 $PHP_FPM_PID;
53+
wait $PHP_FPM_PID;
54+
fi
55+
56+
exit 1;
57+
fi
58+
else
59+
if [ $NGINX_STATUS -ne 0 ] && [ $PHP_FPM_STATUS -ne 0 ]; then
60+
exit 0;
61+
fi
62+
fi
63+
64+
sleep 1
65+
done

‎8.3/base/nginx.conf.tpl‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
user $NGINX_USER;
2+
worker_processes auto;
3+
pid /run/nginx.pid;
4+
5+
events {
6+
worker_connections 768;
7+
}
8+
9+
http {
10+
sendfile on;
11+
tcp_nopush on;
12+
tcp_nodelay on;
13+
keepalive_timeout 65;
14+
types_hash_max_size 2048;
15+
16+
include /etc/nginx/mime.types;
17+
default_type application/octet-stream;
18+
19+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
20+
ssl_prefer_server_ciphers on;
21+
22+
access_log /var/log/nginx/access.log;
23+
error_log /var/log/nginx/error.log;
24+
25+
gzip on;
26+
gzip_disable "msie6";
27+
28+
include /etc/nginx/conf.d/*.conf;
29+
#include /etc/nginx/sites-enabled/*;
30+
31+
server {
32+
listen 80 default_server;
33+
root $NGINX_WEB_ROOT;
34+
35+
location / {
36+
try_files $uri $NGINX_PHP_FALLBACK$is_args$args;
37+
}
38+
location ~ $NGINX_PHP_LOCATION {
39+
fastcgi_pass unix:$PHP_SOCK_FILE;
40+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
41+
include fastcgi_params;
42+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
43+
fastcgi_param DOCUMENT_ROOT $realpath_root;
44+
45+
internal;
46+
}
47+
48+
# return 404 for all other php files not matching the front controller
49+
# this prevents access to other php files you don't want to be accessible.
50+
location ~ \.php$ {
51+
return 404;
52+
}
53+
}
54+
}

‎8.3/base/nginx_ssl.conf.tpl‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
server {
3+
listen 443 ssl http2 default_server;
4+
listen [::]:443 ssl http2 default_server;
5+
root $NGINX_WEB_ROOT;
6+
7+
location / {
8+
try_files $uri $NGINX_PHP_FALLBACK$is_args$args;
9+
}
10+
location ~ $NGINX_PHP_LOCATION {
11+
fastcgi_pass unix:$PHP_SOCK_FILE;
12+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
13+
include fastcgi_params;
14+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
15+
fastcgi_param DOCUMENT_ROOT $realpath_root;
16+
17+
internal;
18+
}
19+
20+
# return 404 for all other php files not matching the front controller
21+
# this prevents access to other php files you don't want to be accessible.
22+
location ~ \.php$ {
23+
return 404;
24+
}
25+
26+
ssl_certificate $NGINX_SSL_PUBLIC_CERTIFICATE;
27+
ssl_certificate_key $NGINX_SSL_PRIVATE_CERTIFICATE;
28+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
29+
ssl_prefer_server_ciphers on;
30+
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
31+
ssl_ecdh_curve secp384r1;
32+
ssl_session_cache shared:SSL:10m;
33+
ssl_session_tickets off;
34+
ssl_stapling on;
35+
ssl_stapling_verify on;
36+
resolver 8.8.8.8 8.8.4.4 valid=300s;
37+
resolver_timeout 5s;
38+
# Disable preloading HSTS for now. You can use the commented out header line that includes
39+
# the "preload" directive if you understand the implications.
40+
#add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
41+
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
42+
add_header X-Frame-Options DENY;
43+
add_header X-Content-Type-Options nosniff;
44+
}

‎8.3/base/php-fpm.conf.tpl‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[www]
2+
3+
pm = dynamic
4+
pm.max_children = 5
5+
pm.start_servers = 2
6+
pm.min_spare_servers = 1
7+
pm.max_spare_servers = 3
8+
9+
clear_env = no
10+
catch_workers_output=yes
11+
decorate_workers_output=no
12+
13+
user = $PHP_USER
14+
group = $PHP_GROUP
15+
listen = $PHP_SOCK_FILE
16+
listen.owner = $PHP_USER
17+
listen.group = $PHP_GROUP
18+
listen.mode = $PHP_MODE

‎8.3/build-images.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -e
5+
6+
(cd 8.3/base && docker buildx build --platform linux/amd64,linux/arm64 --push --rm --pull -t makasim/nginx-php-fpm:8.3 -t makasim/nginx-php-fpm:latest .)
7+
(cd 8.3/php-all-exts && docker buildx build --platform linux/amd64,linux/arm64 --push --rm -t makasim/nginx-php-fpm:8.3-all-exts -t makasim/nginx-php-fpm:latest-all-exts .)

‎8.3/php-all-exts/Dockerfile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM makasim/nginx-php-fpm:8.3
2+
3+
# exts
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends --no-install-suggests \
6+
php-mongodb php-curl php-intl php-soap php-xml php-bcmath \
7+
php-mysql php-amqp php-gearman php-mbstring php-ldap php-zip php-gd php-xdebug php-imagick && \
8+
rm -f /etc/php/8.3/cli/conf.d/*xdebug.ini && \
9+
rm -f /etc/php/8.3/fpm/conf.d/*xdebug.ini && \
10+
rm -rf /var/lib/apt/lists/*

‎8.3/push-images.sh‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -e
5+
6+
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
7+
docker push makasim/nginx-php-fpm:8.3
8+
docker push makasim/nginx-php-fpm:8.3-all-exts
9+
docker push makasim/nginx-php-fpm:latest
10+
docker push makasim/nginx-php-fpm:latest-all-exts

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /