From 42d8a9a0983587515a1aa7d5c74da451b2c85750 Mon Sep 17 00:00:00 2001 From: Hanz Date: Mon, 5 Aug 2024 03:48:42 +0530 Subject: [PATCH] feat: automatic static collect --- entrypoint.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 5d86f1d..cce51fd 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,26 @@ run_migrations() { python manage.py migrate } +collect_static() { + echo "----------------- collecting static files -----------------" + python manage.py collectstatic --noinput --clear + python manage.py collectstatic --noinput + python manage.py compress --force +} + +compress_static() { + echo "----------------- compressing static files -----------------" + python manage.py compress --force +} + +if [ "${COLLECT_STATIC:-false}" ]; then + collect_static + compress_static +else + echo "------------------ skipping collect static files -----------------" +fi + + if [ "${RUN_MIGRATION:-false}" = true ]; then run_migrations else