diff --git a/docker-compose.yml b/docker-compose.yml index b36d4491..f042c277 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -189,6 +189,8 @@ services: - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH} - INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP} - INSTALL_ZIP_ARCHIVE=${PHP_WORKER_INSTALL_ZIP_ARCHIVE} + - PUID=${PHP_WORKER_PUID} + - PGID=${PHP_WORKER_PGID} volumes: - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER} - ./php-worker/supervisord.d:/etc/supervisord.d diff --git a/env-example b/env-example index 93040541..5767720e 100644 --- a/env-example +++ b/env-example @@ -172,6 +172,8 @@ PHP_WORKER_INSTALL_PGSQL=false PHP_WORKER_INSTALL_BCMATH=false PHP_WORKER_INSTALL_SOAP=false PHP_WORKER_INSTALL_ZIP_ARCHIVE=false +PHP_WORKER_PUID=1000 +PHP_WORKER_PGID=1000 ### NGINX ################################################# diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index 555e59fc..fadfb80a 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -25,6 +25,15 @@ RUN apk --update add wget \ RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl RUN pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached +# Add a non-root user: +ARG PUID=1000 +ENV PUID ${PUID} +ARG PGID=1000 +ENV PGID ${PGID} + +RUN addgroup -g ${PGID} laradock && \ + adduser -D -G laradock -u ${PUID} laradock + #Install SOAP package: ARG INSTALL_SOAP=false RUN if [ ${INSTALL_SOAP} = true ]; then \ diff --git a/php-worker/supervisord.d/laravel-worker.conf.example b/php-worker/supervisord.d/laravel-worker.conf.example index 06156bc5..06401183 100644 --- a/php-worker/supervisord.d/laravel-worker.conf.example +++ b/php-worker/supervisord.d/laravel-worker.conf.example @@ -4,4 +4,5 @@ command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon autostart=true autorestart=true numprocs=8 +user=laradock redirect_stderr=true