Skip to content

Commit

Permalink
feat: Update php to 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Annavar-satish committed May 9, 2024
1 parent 89d578a commit cb49509
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "7.4-s6"
- "8.2"
- "8.2-s6"
- "8.3-s6"

jobs:
build-and-push:
Expand Down
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18
FROM alpine:edge

ENV DOCKERIZE_VERSION v0.6.1
# set version for s6 overlay
Expand All @@ -20,14 +20,15 @@ RUN set -ex \
autoconf automake build-base python3 gmp-dev \
curl \
tar \
&& apk add --no-cache --virtual .run-deps \
nodejs npm \
&& apk add --no-cache --virtual .run-deps \
nodejs npm libavif \
&& apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/community add \
# PHP and extensions
php82 php82-bcmath php82-ctype php82-curl php82-dom php82-exif php82-fileinfo \
php82-fpm php82-gd php82-gmp php82-iconv php82-intl php82-mbstring \
php82-mysqlnd php82-mysqli php82-opcache php82-openssl php82-pcntl php82-pecl-apcu php82-pdo php82-pdo_mysql \
php82-phar php82-posix php82-session php82-simplexml php82-sockets php82-sqlite3 php82-tidy \
php82-tokenizer php82-xml php82-xmlreader php82-xmlwriter php82-zip php82-pecl-xdebug php82-pecl-redis php82-soap php82-sodium php82-pdo_sqlite php82-pdo_pgsql php82-pgsql \
php83 php83-bcmath php83-ctype php83-curl php83-dom php83-exif php83-fileinfo \
php83-fpm php83-gd php83-gmp php83-iconv php83-intl php83-mbstring \
php83-mysqlnd php83-mysqli php83-opcache php83-openssl php83-pcntl php83-pecl-apcu php83-pdo php83-pdo_mysql \
php83-phar php83-posix php83-session php83-simplexml php83-sockets php83-sqlite3 php83-tidy \
php83-tokenizer php83-xml php83-xmlreader php83-xmlwriter php83-zip php83-pecl-xdebug php83-pecl-redis php83-soap php83-sodium php83-pdo_sqlite php83-pdo_pgsql php83-pgsql \
# Other dependencies
mariadb-client sudo shadow \
# Miscellaneous packages
Expand All @@ -43,10 +44,10 @@ RUN set -ex \
&& rm -Rf /etc/nginx/nginx.conf \
# Composer
&& wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig \
&& php82 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php82 -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php82 composer-setup.php --install-dir=/usr/bin --filename=composer \
&& php82 -r "unlink('composer-setup.php'); unlink('installer.sig');" \
&& php83 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php83 -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php83 composer-setup.php --install-dir=/usr/bin --filename=composer \
&& php83 -r "unlink('composer-setup.php'); unlink('installer.sig');" \
# Cleanup
&& apk del .build-deps

Expand All @@ -69,13 +70,14 @@ RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
ADD rootfs /

RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf && \
ln -s /etc/php82/php.ini /etc/php82/conf.d/php.ini && \
ln -s /usr/bin/php82 /usr/bin/php && \
ln -s /etc/php83/php.ini /etc/php83/conf.d/php.ini && \
rm -rf /usr/bin/php && \
ln -s /usr/bin/php83 /usr/bin/php && \
chown -R nginx:nginx /var/www && \
chmod 755 /etc/s6-overlay/s6-rc.d/*/run && \
chmod 755 /etc/s6-overlay/s6-rc.d/*/up && \
mkdir -p /var/www/storage/logs/ && \
touch /var/www/storage/logs/laravel.log /var/log/nginx/error.log /var/log/php82/error.log
touch /var/www/storage/logs/laravel.log /var/log/nginx/error.log /var/log/php83/error.log

################## CONFIGURATION ENDS ##################

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
; into a local file.
; Note: the default prefix is /var
; Default Value: log/php7/error.log
error_log = /var/log/php82/error.log
error_log = /var/log/php83/error.log

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
Expand Down Expand Up @@ -122,6 +122,6 @@ daemonize = no
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p argument)
; - /usr otherwise
include=/etc/php82/php-fpm.d/*.conf
include=/etc/php83/php-fpm.d/*.conf

php_flag[display_errors] = {{ default .Env.PHP_DISPLAY_ERRORS "off" }}
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ pm.max_requests = 200
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/log/php82/$pool.slow.log
slowlog = /var/log/php83/$pool.slow.log

; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
Expand Down Expand Up @@ -408,6 +408,6 @@ clear_env = no
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
php_flag[display_errors] = On
php_admin_value[error_log] = /var/log/php82/$pool.error.log
php_admin_value[error_log] = /var/log/php83/$pool.error.log
php_admin_flag[log_errors] = On
;php_admin_value[memory_limit] = 32M
File renamed without changes.
5 changes: 0 additions & 5 deletions rootfs/etc/s6-overlay/s6-rc.d/init-php82-fpm/run

This file was deleted.

1 change: 0 additions & 1 deletion rootfs/etc/s6-overlay/s6-rc.d/init-php82-fpm/up

This file was deleted.

5 changes: 5 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/init-php83-fpm/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

# add environment variable into files
dockerize -template /etc/php83/php.ini:/etc/php83/php.ini -template /etc/php83/php-fpm.conf:/etc/php83/php-fpm.conf -template /etc/php83/php-fpm.d:/etc/php83/php-fpm.d
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/init-php83-fpm/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-php83-fpm/run
3 changes: 0 additions & 3 deletions rootfs/etc/s6-overlay/s6-rc.d/svc-php82-fpm/run

This file was deleted.

3 changes: 3 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/svc-php83-fpm/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash

/usr/sbin/php-fpm83 --nodaemonize --fpm-config /etc/php83/php-fpm.conf
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/s6-rc.d/svc-stdout/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/with-contenv bash

dockerize -stdout /var/www/storage/logs/laravel.log -stdout /var/log/nginx/error.log -stdout /var/log/php82/error.log -poll
dockerize -stdout /var/www/storage/logs/laravel.log -stdout /var/log/nginx/error.log -stdout /var/log/php83/error.log -poll

0 comments on commit cb49509

Please sign in to comment.