Prechádzať zdrojové kódy

Drop privileges when starting artisan or horizon

kaiyou 6 rokov pred
rodič
commit
a5761f7ebf

+ 1 - 1
contrib/docker/Dockerfile.apache

@@ -4,7 +4,7 @@ ARG COMPOSER_VERSION="1.6.5"
 ARG COMPOSER_CHECKSUM="67bebe9df9866a795078bb2cf21798d8b0214f2e0b2fd81f2e907a8ef0be3434"
 
 RUN apt-get update \
- && apt-get install -y --no-install-recommends git \
+ && apt-get install -y --no-install-recommends git gosu \
       optipng pngquant jpegoptim gifsicle \
       libfreetype6 libjpeg62-turbo libpng16-16 libxpm4 libvpx4 libmagickwand-6.q16-3 \
       libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libvpx-dev libmagickwand-dev \

+ 4 - 4
contrib/docker/start.sh

@@ -2,18 +2,18 @@
 
 # Create the storage tree if needed and fix permissions
 cp -r storage.skel/* storage/
-chown -R www-data:www-data storage/
+chown -R www-data:www-data storage/ bootstrap/cache/
 php artisan storage:link
 
 # Migrate database if the app was upgraded
-php artisan migrate --force
+gosu www-data:www-data php artisan migrate --force
 
 # Run other specific migratins if required
-php artisan update
+gosu www-data:www-data php artisan update
 
 # Run a worker if it is set as embedded
 if [ $HORIZON_EMBED = true ]; then
-	php artisan horizon &
+  gosu www-data:www-data php artisan horizon &
 fi
 
 # Finally run Apache

+ 1 - 1
docker-compose.yml

@@ -38,7 +38,7 @@ services:
   #     - "app-storage:/var/www/storage"
   #   networks:
   #     - internal
-  #   command: php artisan horizon
+  #   command: gosu www-data php artisan horizon
     
   db:
     image: mysql:5.7