This commit is contained in:
2022-12-06 13:15:58 +08:00
parent 17339d3259
commit a0849e40ef
52 changed files with 463 additions and 43 deletions

View File

@@ -7,6 +7,8 @@
# - /var/lib/nginx/html #
# - /var/log/nginx #
# - /var/log/php7 #
# ENV #
# - GLOBAL_DIRECTIVES #
##################################################
set -euo pipefail
@@ -15,6 +17,7 @@ trap Quit EXIT
PIDS=
GOT_SIGTERM=
GLOBAL_DIRECTIVES="${GLOBAL_DIRECTIVES:-user nginx;worker_processes auto;}"
function Print {
local file=/dev/null
@@ -24,6 +27,8 @@ function Print {
function Quit {
local running
Print killing nginx ...
nginx -s quit || true
while running= ; do
pkill -f php-fpm7 && running=1 && Print killing php-fpm7 ...
pkill -f sleep && running=1 && Print killing sleep ...
@@ -35,6 +40,11 @@ function Quit {
test -n "$GOT_SIGTERM"
}
function ChangeOwner {
Print Change file owner ...
chown nginx.root /var/log/nginx/
}
function SideCar {
local day= last_day=$(date +%d)
local md5= last_md5=$(find /etc/nginx/ -type f -name "*.conf" \
@@ -61,7 +71,7 @@ function StartProc {
php-fpm7 -F -y /etc/php7/php-fpm.conf &
PIDS="$PIDS $!"
Print Start nginx ...
nginx -g 'daemon off;pid /run/nginx/nginx.pid;' &
nginx -g "$GLOBAL_DIRECTIVES" &
PIDS="$PIDS $!"
Print Start nginx sidecar ...
SideCar &
@@ -70,6 +80,7 @@ function StartProc {
function Main {
local pid=
ChangeOwner
StartProc
trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM
while [ -z "$GOT_SIGTERM" ] && sleep 1; do

View File

@@ -2,11 +2,12 @@ ARG ARCH
FROM harbor.colben.cn/general/nginx$ARCH
MAINTAINER Colben colbenlee@gmail.com
ADD --chown=root:root /ADD/ /opt/
RUN apk update \
RUN sed -i '/edge/d' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache php7 php7-common php7-iconv php7-json php7-gd php7-curl php7-xml \
php7-mysqli php7-imap php7-cgi fcgi php7-pdo php7-pdo_mysql php7-soap php7-xmlrpc \
php7-posix php7-mcrypt php7-gettext php7-ldap php7-ctype php7-dom php7-fpm \
php7-mbstring php7-mysqlnd php7-bcmath php7-session php7-openssl php7-opcache \
php7-mbstring php7-mysqlnd php7-bcmath php7-session php7-openssl php7-opcache composer \
&& sed -i -e '/^;* *max_execution_time *=/cmax_execution_time = 300' \
-e '/^;* *memory_limit *=/cmemory_limit = 1024M' \
-e '/^;* *post_max_size *=/cpost_max_size = 1024M' \

View File

@@ -6,7 +6,6 @@
set -euo pipefail
export LANG=en_US.UTF-8
trap Quit EXIT
[ 'x86_64' == "$(uname -m)" ] && ARCH='' || ARCH="-$(uname -m)"
ROOT_DIR="$(cd $(dirname $0) && pwd)"
@@ -57,6 +56,7 @@ function Build {
}
function Main {
trap Quit EXIT
Update
Build
END=1