diff --git a/Dockerfile b/Dockerfile index b213492..649c5d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,16 +25,20 @@ WORKDIR /var/www COPY . . COPY .env.example .env -# Install dependencies -RUN composer install --no-interaction --prefer-dist --optimize-autoloader +# Set www-data user permission before running composer/install artisan +RUN chown -R www-data:www-data /var/www -# Generate app key -RUN php artisan key:generate +USER www-data -# Set permissions -RUN chown -R www-data:www-data /var/www \ - && chmod -R 775 storage bootstrap/cache \ - && chown -R www-data:www-data storage bootstrap/cache +# Install dependencies & generate app key as www-data user +RUN composer install --no-interaction --prefer-dist --optimize-autoloader \ + && php artisan key:generate + +USER root + +# Set permissions again just in case +RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \ + && chmod -R 775 /var/www/storage /var/www/bootstrap/cache EXPOSE 9000 -CMD ["php-fpm"] \ No newline at end of file +CMD ["php-fpm"]