From 5a083bace20eb0fe4ecc6668a36e533537c4ad49 Mon Sep 17 00:00:00 2001 From: Mateo Date: Fri, 2 Oct 2026 21:15:32 +0200 Subject: [PATCH] fix: optimize Dockerfile and entrypoint script for improved caching and cleanup --- Dockerfile | 4 +--- docker-compose/prod/entrypoint.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b19f32..511f89d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,6 @@ RUN npm ci COPY . . RUN composer dump-autoload --optimize --no-dev \ - && php artisan config:cache \ - && php artisan route:cache \ - && php artisan view:cache \ && npm run build # ── Runtime Stage ──────────────────────────────────────────── @@ -48,6 +45,7 @@ COPY --from=build /var/www /var/www RUN rm -rf node_modules tests .git .editorconfig .prettierrc .prettierignore \ && rm -f docker-compose.prod.yml Dockerfile .dockerignore \ && rm -f README.md LICENSE \ + && rm -f bootstrap/cache/*.php \ && mkdir -p storage/framework/{cache,sessions,views} storage/logs bootstrap/cache \ && chown -R www-data:www-data storage bootstrap/cache diff --git a/docker-compose/prod/entrypoint.sh b/docker-compose/prod/entrypoint.sh index b52bb4e..8b31d48 100644 --- a/docker-compose/prod/entrypoint.sh +++ b/docker-compose/prod/entrypoint.sh @@ -5,14 +5,19 @@ echo "Starting Taskly..." mkdir -p storage/framework/{cache,sessions,views} storage/logs bootstrap/cache -php artisan migrate --force - -php artisan config:cache 2>/dev/null || true +php artisan config:clear +php artisan config:cache php artisan route:cache 2>/dev/null || true php artisan view:cache 2>/dev/null || true +php artisan migrate --force + chown -R www-data:www-data storage bootstrap/cache echo "Taskly is ready." +if [ $# -gt 0 ]; then + exec "$@" +fi + exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf