mirror of
https://github.com/jkaninda/nginx-php-fpm.git
synced 2025-12-06 05:29:43 +01:00
Update PHP Version
This commit is contained in:
2
build.sh
2
build.sh
@@ -11,6 +11,6 @@ then
|
||||
docker build -f src/docker/${tag}/Dockerfile -t jkaninda/nginx-php-fpm:$tag .
|
||||
else
|
||||
echo 'Build latest'
|
||||
docker build -f src/docker/8.2/Dockerfile -t jkaninda/nginx-php-fpm:$tag .
|
||||
docker build -f src/docker/8.3/Dockerfile -t jkaninda/nginx-php-fpm:$tag .
|
||||
|
||||
fi
|
||||
|
||||
@@ -5,8 +5,10 @@ ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -80,10 +82,12 @@ ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
@@ -5,8 +5,10 @@ ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -80,11 +82,12 @@ RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
@@ -5,8 +5,10 @@ ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -80,10 +82,12 @@ ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
@@ -5,8 +5,10 @@ ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -91,11 +93,12 @@ RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
@@ -5,8 +5,10 @@ ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -91,13 +93,13 @@ RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@ ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -93,11 +95,13 @@ ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
FROM php:8.3.0-fpm
|
||||
FROM php:8.3.1-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
ARG GROUP_ID=1000
|
||||
ARG USER_ID=1000
|
||||
ENV USER_NAME=www-data
|
||||
ARG GROUP_NAME=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
@@ -93,11 +95,14 @@ ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
RUN usermod -u ${USER_ID} ${USER_NAME}
|
||||
RUN groupmod -g ${USER_ID} ${GROUP_NAME}
|
||||
RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \
|
||||
chown -R ${USER_NAME}:${GROUP_NAME} /etc/nginx/sites-available/
|
||||
#USER ${USER_NAME}
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
|
||||
@@ -1,32 +1,41 @@
|
||||
#!/bin/sh
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
|
||||
echo ""
|
||||
echo "***********************************************************"
|
||||
echo " Starting NGINX PHP-FPM Docker Container "
|
||||
echo "***********************************************************"
|
||||
|
||||
set -e
|
||||
|
||||
set -e
|
||||
info() {
|
||||
{ set +x; } 2> /dev/null
|
||||
echo '[INFO] ' "$@"
|
||||
}
|
||||
warning() {
|
||||
{ set +x; } 2> /dev/null
|
||||
echo '[WARNING] ' "$@"
|
||||
}
|
||||
fatal() {
|
||||
{ set +x; } 2> /dev/null
|
||||
echo '[ERROR] ' "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
## Check if the artisan file exists
|
||||
if [ -f /var/www/html/artisan ]; then
|
||||
echo "${Green} artisan file found, creating laravel supervisor config"
|
||||
info "Artisan file found, creating laravel supervisor config"
|
||||
# Set DocumentRoot to the Laravel project directory
|
||||
export DOCUMENT_ROOT=/var/www/html/public
|
||||
##Create Laravel Scheduler process
|
||||
TASK=/etc/supervisor/conf.d/laravel-worker.conf
|
||||
touch $TASK
|
||||
cat > "$TASK" <<EOF
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
[program:Laravel-scheduler]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=/bin/sh -c "while [ true ]; do (php /var/www/html/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=1
|
||||
user=www-data
|
||||
user=$USER_NAME
|
||||
stdout_logfile=/var/log/laravel_scheduler.out.log
|
||||
redirect_stderr=true
|
||||
|
||||
@@ -36,30 +45,30 @@ if [ -f /var/www/html/artisan ]; then
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=$LARAVEL_PROCS_NUMBER
|
||||
user=www-data
|
||||
user=$USER_NAME
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/log/laravel_worker.log
|
||||
EOF
|
||||
echo "${Green} Laravel supervisor config created"
|
||||
info "Laravel supervisor config created"
|
||||
else
|
||||
echo "${Red} artisan file not found"
|
||||
info "artisan file not found"
|
||||
fi
|
||||
|
||||
# Enable custom nginx config files if they exist
|
||||
if [ -f /var/www/html/conf/nginx/nginx.conf ]; then
|
||||
cp /var/www/html/conf/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
echo "Using custom nginx.conf"
|
||||
info "Using custom nginx.conf"
|
||||
fi
|
||||
|
||||
if [ -f /var/www/html/conf/nginx/nginx-site.conf ]; then
|
||||
echo "Custom nginx site config found"
|
||||
info "Custom nginx site config found"
|
||||
rm /etc/nginx/sites-available/default
|
||||
cp /var/www/html/conf/nginx/nginx-site.conf /etc/nginx/sites-available/default
|
||||
echo "${Green} Start nginx with custom server config..."
|
||||
info "Start nginx with custom server config..."
|
||||
else
|
||||
echo "${Red} nginx-site.conf not found"
|
||||
echo "${Green} If you want to use custom configs, create config file in /var/www/html/conf/nginx/nginx-site.conf"
|
||||
echo "${Green} Start nginx with default config..."
|
||||
info "Nginx-site.conf not found"
|
||||
info "If you want to use custom configs, create config file in /var/www/html/conf/nginx/nginx-site.conf"
|
||||
info "Start nginx with default config..."
|
||||
rm -f /etc/nginx/sites-available/default
|
||||
TASK=/etc/nginx/sites-available/default
|
||||
touch $TASK
|
||||
@@ -115,19 +124,13 @@ EOF
|
||||
fi
|
||||
## Check if the supervisor config file exists
|
||||
if [ -f /var/www/html/conf/worker/supervisor.conf ]; then
|
||||
echo "Custom supervisor config found"
|
||||
info "Custom supervisor config found"
|
||||
cp /var/www/html/conf/worker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
|
||||
else
|
||||
echo "${Red} Supervisor.conf not found"
|
||||
echo "${Green} If you want to add more supervisor configs, create config file in /var/www/html/conf/worker/supervisor.conf"
|
||||
echo "${Green} Start supervisor with default config..."
|
||||
info "Supervisor.conf not found"
|
||||
info "If you want to add more supervisor configs, create config file in /var/www/html/conf/worker/supervisor.conf"
|
||||
info "Start supervisor with default config..."
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo ""
|
||||
echo "**********************************"
|
||||
echo " Starting Supervisord... "
|
||||
echo "***********************************"
|
||||
supervisord -c /etc/supervisor/supervisord.conf
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ autorestart=true
|
||||
stderr_logfile=/var/log/php-fpm_consumer.err.log
|
||||
stdout_logfile=/var/log/php-fpm_consumer.out.log
|
||||
user=root
|
||||
priority=100
|
||||
priority=1
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g "daemon off;"
|
||||
@@ -23,7 +23,7 @@ autorestart=true
|
||||
stderr_logfile=/var/log/nginx.err.log
|
||||
stdout_logfile=/var/log/nginx.out.log
|
||||
user=root
|
||||
priority=100
|
||||
priority=2
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
||||
Reference in New Issue
Block a user