From 7eb8d76c87c64bea61ad5a670df02475628ec29b Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 12 Apr 2024 16:37:21 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E5=A4=8Ddocker=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E8=AF=A5=E7=94=A8=E9=9D=9Eroot=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E5=85=A8=E6=8C=82=E8=BD=BD=E5=92=8Csqlite=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E6=8A=A5=E9=94=99=E5=B9=B6=E5=87=8F=E5=B0=91layers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .docker/etc/supervisor/supervisord.conf | 2 ++ Dockerfile | 11 +++++------ init.sh | 4 ++-- update.sh | 4 ++-- update_dev.sh | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.docker/etc/supervisor/supervisord.conf b/.docker/etc/supervisor/supervisord.conf index 0eb7ee7..7a1ab26 100644 --- a/.docker/etc/supervisor/supervisord.conf +++ b/.docker/etc/supervisor/supervisord.conf @@ -1,5 +1,6 @@ [supervisord] nodaemon=true +user=root logfile=/dev/null logfile_maxbytes=0 pidfile=/tmp/supervisord.pid @@ -17,6 +18,7 @@ startretries=10 [program:cron] command=crond -f -l 8 +user=root stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/Dockerfile b/Dockerfile index 45a84bb..70cc6fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,17 +2,16 @@ FROM phpswoole/swoole:php8.1-alpine COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ -RUN install-php-extensions pcntl bcmath - -RUN apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git - -RUN addgroup -S -g 1001 www && adduser -S -G www -u 1001 www +RUN install-php-extensions pcntl bcmath \ +&& apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git \ +&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www #复制项目文件以及配置文件 WORKDIR /www COPY .docker / COPY . /www RUN composer install --optimize-autoloader --no-cache --no-dev \ && php artisan storage:link \ -&& chown -R www:www /www +&& chown -R www:www /www \ +&& chmod -R 777 /www CMD [ "/usr/bin/supervisord", "--nodaemon", "-c" ,"/etc/supervisor/supervisord.conf" ] \ No newline at end of file diff --git a/init.sh b/init.sh index 6d41d51..9de403d 100644 --- a/init.sh +++ b/init.sh @@ -5,6 +5,6 @@ wget https://github.com/composer/composer/releases/latest/download/composer.phar php composer.phar install -vvv php artisan xboard:install -if [ -f "/etc/init.d/bt" ]; then - chown -R www $(pwd); +if [ -f "/etc/init.d/bt" ] || [ "$docker" ]; then + chown -R www:www $(pwd); fi diff --git a/update.sh b/update.sh index bad1ab7..02e7769 100755 --- a/update.sh +++ b/update.sh @@ -17,6 +17,6 @@ wget https://github.com/composer/composer/releases/latest/download/composer.phar php composer.phar update -vvv php artisan xboard:update -if [ -f "/etc/init.d/bt" ]; then - chown -R www $(pwd); +if [ -f "/etc/init.d/bt" ] || [ "$docker" ]; then + chown -R www:www $(pwd); fi diff --git a/update_dev.sh b/update_dev.sh index 7eeda47..2a22baa 100755 --- a/update_dev.sh +++ b/update_dev.sh @@ -18,6 +18,6 @@ wget https://github.com/composer/composer/releases/latest/download/composer.phar php composer.phar update -vvv php artisan xboard:update -if [ -f "/etc/init.d/bt" ]; then - chown -R www $(pwd); +if [ -f "/etc/init.d/bt" ] || [ "$docker" ]; then + chown -R www:www $(pwd); fi