upgrade to PHP 8.1

This commit is contained in:
El RIDO 2022-11-05 08:09:58 +01:00
parent 2fa45c2159
commit e96787428d
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
6 changed files with 15 additions and 15 deletions

View file

@ -1,6 +1,6 @@
FROM alpine:3.16.2
ARG ALPINE_PACKAGES="php8-pdo_mysql php8-pdo_pgsql php8-openssl"
ARG ALPINE_PACKAGES="php81-pdo_mysql php81-pdo_pgsql php81-openssl"
ARG COMPOSER_PACKAGES=google/cloud-storage
ARG PBURL=https://github.com/PrivateBin/PrivateBin/
ARG RELEASE=1.4.0
@ -21,15 +21,15 @@ RUN \
ALPINE_PACKAGES="$(echo ${ALPINE_PACKAGES} | sed 's/,/ /g')" ;\
ALPINE_COMPOSER_PACKAGES="" ;\
if [ -n "${COMPOSER_PACKAGES}" ] ; then \
ALPINE_COMPOSER_PACKAGES="php8 php8-curl php8-mbstring php8-phar" ;\
ALPINE_COMPOSER_PACKAGES="php81 php81-curl php81-mbstring php81-phar" ;\
RAWURL="$(echo ${PBURL} | sed s/github.com/raw.githubusercontent.com/)" ;\
fi \
# Install dependencies
&& apk upgrade --no-cache \
&& apk add --no-cache gnupg git nginx php8-fpm php8-json php8-gd php8-opcache \
s6 tzdata ${ALPINE_PACKAGES} ${ALPINE_COMPOSER_PACKAGES} \
&& apk add --no-cache gnupg git nginx php81-fpm php81-gd php81-opcache s6 \
tzdata ${ALPINE_PACKAGES} ${ALPINE_COMPOSER_PACKAGES} \
# Remove (some of the) default nginx config
&& rm -f /etc/nginx.conf /etc/nginx/http.d/default.conf /etc/php8/php-fpm.d/www.conf \
&& rm -f /etc/nginx.conf /etc/nginx/http.d/default.conf /etc/php81/php-fpm.d/www.conf \
&& rm -rf /etc/nginx/sites-* \
# Ensure nginx logs, even if the config has errors, are written to stderr
&& ln -s /dev/stderr /var/log/nginx/error.log \
@ -51,7 +51,7 @@ RUN \
fi \
&& if [ -n "${COMPOSER_PACKAGES}" ] ; then \
wget -qO composer-installer.php https://getcomposer.org/installer \
&& ln -s $(which php8) /usr/local/bin/php \
&& ln -s $(which php81) /usr/local/bin/php \
&& php composer-installer.php --install-dir=/usr/local/bin --filename=composer ;\
fi \
&& cd /var/www \
@ -69,10 +69,10 @@ RUN \
&& mkdir -p /srv/data \
&& sed -i "s#define('PATH', '');#define('PATH', '/srv/');#" index.php \
# Support running s6 under a non-root user
&& mkdir -p /etc/s6/services/nginx/supervise /etc/s6/services/php-fpm8/supervise \
&& mkdir -p /etc/s6/services/nginx/supervise /etc/s6/services/php-fpm81/supervise \
&& mkfifo \
/etc/s6/services/nginx/supervise/control \
/etc/s6/services/php-fpm8/supervise/control \
/etc/s6/services/php-fpm81/supervise/control \
&& chown -R ${UID}:${GID} /etc/s6 /run /srv/* /var/lib/nginx /var/www \
&& chmod o+rwx /run /var/lib/nginx /var/lib/nginx/tmp \
# Clean up

View file

@ -52,7 +52,7 @@ Note: The `Filesystem` data storage is supported out of the box. The image inclu
### Adjusting nginx or php-fpm settings
You can attach your own `php.ini` or nginx configuration files to the folders `/etc/php8/conf.d/` and `/etc/nginx/conf.d/` respectively. This would for example let you adjust the maximum size these two services accept for file uploads, if you need more then the default 10 MiB.
You can attach your own `php.ini` or nginx configuration files to the folders `/etc/php81/conf.d/` and `/etc/nginx/conf.d/` respectively. This would for example let you adjust the maximum size these two services accept for file uploads, if you need more then the default 10 MiB.
### Timezone settings
@ -147,10 +147,10 @@ docker build -t privatebin/nginx-fpm-alpine .
### Behind the scenes
The two processes, Nginx and php-fpm, are started by s6 overlay.
The two processes, Nginx and php-fpm, are started by s6.
Nginx is required to serve static files and caches them, too. Requests to the index.php (which is the only PHP file exposed in the document root at /var/www) are passed to php-fpm via a socket at /run/php-fpm.sock. All other PHP files and the data are stored under /srv.
The Nginx setup supports only HTTP, so make sure that you run a reverse proxy in front of this for HTTPS offloading and reducing the attack surface on your TLS stack. The Nginx in this image is set up to deflate/gzip text content.
During the build of the image the PrivateBin release archive and the s6 overlay binaries are downloaded from Github. All the downloaded Alpine packages, s6 overlay binaries and the PrivateBin archive are validated using cryptographic signatures to ensure they have not been tempered with, before deploying them in the image.
During the build of the image the PrivateBin release archive is downloaded from Github. All the downloaded Alpine packages and the PrivateBin archive are validated using cryptographic signatures to ensure they have not been tempered with, before deploying them in the image.

View file

@ -57,10 +57,10 @@ main() {
BUILD_ARGS="--build-arg ALPINE_PACKAGES= --build-arg COMPOSER_PACKAGES="
;;
pdo)
BUILD_ARGS="--build-arg ALPINE_PACKAGES=php8-pdo_mysql,php8-pdo_pgsql --build-arg COMPOSER_PACKAGES="
BUILD_ARGS="--build-arg ALPINE_PACKAGES=php81-pdo_mysql,php81-pdo_pgsql --build-arg COMPOSER_PACKAGES="
;;
gcs)
BUILD_ARGS="--build-arg ALPINE_PACKAGES=php8-openssl"
BUILD_ARGS="--build-arg ALPINE_PACKAGES=php81-openssl"
;;
*)
BUILD_ARGS=""
@ -70,7 +70,7 @@ main() {
if [ "$EDGE" = true ] ; then
sed -e 's/^FROM alpine:.*$/FROM alpine:edge/' Dockerfile > Dockerfile.edge
BUILD_ARGS="-f Dockerfile.edge --tag $IMAGE:edge $BUILD_ARGS"
BUILD_ARGS="-f Dockerfile.edge --tag $IMAGE:edge $BUILD_ARGS"
IMAGE="$IMAGE:edge"
else
BUILD_ARGS="--tag $IMAGE:latest --tag $IMAGE:$TAG --tag ${IMAGE}:${TAG%%-*} $BUILD_ARGS"

View file

@ -1,2 +1,2 @@
#!/bin/execlineb -P
/usr/sbin/php-fpm8
/usr/sbin/php-fpm81