Skip to content

Commit 03ff791

Browse files
lanphanbestlong
authored andcommitted
php-worker: add laradock user (laradock#1928)
1 parent 7c4f6dd commit 03ff791

4 files changed

Lines changed: 14 additions & 0 deletions

File tree

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ services:
189189
- INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH}
190190
- INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP}
191191
- INSTALL_ZIP_ARCHIVE=${PHP_WORKER_INSTALL_ZIP_ARCHIVE}
192+
- PUID=${PHP_WORKER_PUID}
193+
- PGID=${PHP_WORKER_PGID}
192194
volumes:
193195
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
194196
- ./php-worker/supervisord.d:/etc/supervisord.d

env-example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ PHP_WORKER_INSTALL_PGSQL=false
172172
PHP_WORKER_INSTALL_BCMATH=false
173173
PHP_WORKER_INSTALL_SOAP=false
174174
PHP_WORKER_INSTALL_ZIP_ARCHIVE=false
175+
PHP_WORKER_PUID=1000
176+
PHP_WORKER_PGID=1000
175177

176178
### NGINX #################################################
177179

php-worker/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ RUN apk --update add wget \
2525
RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl
2626
RUN pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached
2727

28+
# Add a non-root user:
29+
ARG PUID=1000
30+
ENV PUID ${PUID}
31+
ARG PGID=1000
32+
ENV PGID ${PGID}
33+
34+
RUN addgroup -g ${PGID} laradock && \
35+
adduser -D -G laradock -u ${PUID} laradock
36+
2837
#Install SOAP package:
2938
ARG INSTALL_SOAP=false
3039
RUN if [ ${INSTALL_SOAP} = true ]; then \

php-worker/supervisord.d/laravel-worker.conf.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
44
autostart=true
55
autorestart=true
66
numprocs=8
7+
user=laradock
78
redirect_stderr=true

0 commit comments

Comments
 (0)