Skip to content

Commit

Permalink
Merge pull request #250 from rafalohaki/main
Browse files Browse the repository at this point in the history
Update Version Alpine/PHP
  • Loading branch information
hnhx authored Jun 24, 2023
2 parents e11a20c + e2eead1 commit b5a9f12
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax = edrevo/dockerfile-plus
ARG VERSION="3.17"
ARG VERSION="3.18"
FROM alpine:${VERSION} AS librex
WORKDIR "/var/www/html"

Expand Down
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
sh "docker/php/prepare.sh"
sh "docker/server/prepare.sh"

/bin/sh -c /usr/sbin/php-fpm7
/bin/sh -c /usr/sbin/php-fpm8

exec nginx -g "daemon off;"
6 changes: 3 additions & 3 deletions docker/php/php.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set this argument during build time to indicate that the path is for php's www.conf
ARG WWW_CONFIG="/etc/php7/php-fpm.d/www.conf"
ARG WWW_CONFIG="/etc/php8/php-fpm.d/www.conf"

# Configure 'opensearch.xml' with Librex configuration metadata, such as the encoding and the host that stores the site
# These configurations will replace the 'opensearch.xml' inside '.dockers/templates' for the best setup for your instance
Expand Down Expand Up @@ -52,8 +52,8 @@ ENV CURLOPT_VERBOSE=true

# Install PHP-FPM using Alpine's package manager, apk
# Configure PHP-FPM to listen on a Unix socket instead of a TCP port, which is more secure and efficient
RUN apk add php7 php7-fpm php7-dom php7-curl php7-json --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing &&\
sed -i 's/^\s*listen = 127.0.0.1:9000/listen = \/run\/php7\/php-fpm7.sock/' ${WWW_CONFIG} &&\
RUN apk add php8 php8-fpm php8-dom php8-curl php8-json --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing &&\
sed -i 's/^\s*listen = 127.0.0.1:9000/listen = \/run\/php8\/php-fpm8.sock/' ${WWW_CONFIG} &&\
sed -i 's/^\s*;\s*listen.owner = nobody/listen.owner = nginx/' ${WWW_CONFIG} &&\
sed -i 's/^\s*;\s*listen.group = nobody/listen.group = nginx/' ${WWW_CONFIG} &&\
sed -i 's/^\s*;\s*listen.mode = 0660/listen.mode = 0660/' ${WWW_CONFIG}
Expand Down
12 changes: 6 additions & 6 deletions docker/php/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ echo "[PREPARE] docker/server/prepare.sh'"
# Load all environment variables from 'attributes.sh' using the command 'source /path/attributes.sh'
source "docker/attributes.sh"

# This condition creates the Unix socket if 'php-fpm7.sock' does not already exist.
# This condition creates the Unix socket if 'php-fpm8.sock' does not already exist.
# This fixes an issue where Nginx starts but does not serve content
if [ ! -d "/run/php7" ] || [ ! -S "/run/php7/php-fpm7.sock" ]; then
mkdir "/run/php7"
touch "/run/php7/php-fpm7.sock"
chmod 660 "/run/php7/php-fpm7.sock"
chown nginx:nginx "/run/php7/php-fpm7.sock"
if [ ! -d "/run/php8" ] || [ ! -S "/run/php8/php-fpm8.sock" ]; then
mkdir "/run/php8"
touch "/run/php8/php-fpm8.sock"
chmod 660 "/run/php8/php-fpm8.sock"
chown nginx:nginx "/run/php8/php-fpm8.sock"
fi

# The lines below will replace the environment variables in the templates with the corresponding variables listed above. To accomplish this, the GNU 'envsubst' package will be used
Expand Down
2 changes: 1 addition & 1 deletion docker/server/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ server {
}

location ~ \.php$ {
fastcgi_pass unix:/run/php7/php-fpm7.sock;
fastcgi_pass unix:/run/php8/php-fpm8.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
Expand Down

0 comments on commit b5a9f12

Please sign in to comment.