Skip to content

Commit 6e6b66a

Browse files
author
xboard
committed
chore: 修复docker环境该用非root运行时全挂载和sqlite部署报错并减少layers
1 parent 03706c0 commit 6e6b66a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

.docker/etc/supervisor/supervisord.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[supervisord]
22
nodaemon=true
3+
user=root
34
logfile=/dev/null
45
logfile_maxbytes=0
56
pidfile=/tmp/supervisord.pid
@@ -17,6 +18,7 @@ startretries=10
1718

1819
[program:cron]
1920
command=crond -f -l 8
21+
user=root
2022
stdout_logfile=/dev/stdout
2123
stdout_logfile_maxbytes=0
2224
stderr_logfile=/dev/stderr

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ FROM phpswoole/swoole:php8.1-alpine
22

33
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
44

5-
RUN install-php-extensions pcntl bcmath
6-
7-
RUN apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git
8-
9-
RUN addgroup -S -g 1001 www && adduser -S -G www -u 1001 www
5+
RUN install-php-extensions pcntl bcmath \
6+
&& apk --no-cache add shadow supervisor nginx sqlite nginx-mod-http-brotli mysql-client git \
7+
&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www
108
#复制项目文件以及配置文件
119
WORKDIR /www
1210
COPY .docker /
1311
COPY . /www
1412
RUN composer install --optimize-autoloader --no-cache --no-dev \
1513
&& php artisan storage:link \
16-
&& chown -R www:www /www
14+
&& chown -R www:www /www \
15+
&& chmod -R 777 /www
1716

1817
CMD [ "/usr/bin/supervisord", "--nodaemon", "-c" ,"/etc/supervisor/supervisord.conf" ]

init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ php composer.phar install -vvv
66
php artisan xboard:install
77

88
if [ -f "/etc/init.d/bt" ]; then
9-
chown -R www $(pwd);
9+
chown -R www:www $(pwd);
1010
fi

0 commit comments

Comments
 (0)