chore: 修复docker环境该用非root运行时全挂载和sqlite部署报错并减少layers

This commit is contained in:
xboard 2024-04-12 16:37:21 +08:00
parent 03706c054d
commit 7eb8d76c87
5 changed files with 13 additions and 12 deletions

View File

@ -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

View File

@ -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" ]

View File

@ -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

View File

@ -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

View File

@ -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