From 6655ccca6e8a17a068bca558127b971eeed506cd Mon Sep 17 00:00:00 2001 From: Fredrik Falk Date: Mon, 21 Oct 2024 18:46:42 +0200 Subject: [PATCH] Speed up docker start (#647) Starting the docker container is hampered due to setting `chown -R www-data:www-data /var/www/html/` on every start, causing it to traverse the entire directory which in our use case is very slow. This PR instead changes it to set permissions as part of the build process. Sidenote: Is `LE_EMAIL` supposed to be used in addition to `ADMIN_EMAIL`? --- .github/docker/entrypoint.sh | 2 +- Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index 9a801e2d9..ad1b359b6 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -58,7 +58,7 @@ else echo "Starting PHP-FPM only" fi -chown -R www-data:www-data . /pelican-data/.env /pelican-data/database +chown -R www-data:www-data /pelican-data/.env /pelican-data/database echo "Starting Supervisord" exec "$@" diff --git a/Dockerfile b/Dockerfile index c759649f1..3e2da6482 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,8 @@ RUN touch .env RUN composer install --no-dev --optimize-autoloader # Set file permissions -RUN chmod -R 755 storage bootstrap/cache +RUN chmod -R 755 storage bootstrap/cache \ + && chown -R www-data:www-data ./ # Add scheduler to cron RUN echo "* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1" | crontab -u www-data -