From ca9e621143e7394e8c0ebd55031bf3fbf2087c35 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Mon, 9 Dec 2019 21:42:04 +0100
Subject: [PATCH] [Docker] Move collectstatic to entrypoint script

This is needed because when updating an existing environment, the
existing volume will shadow away the changes done on container build.
---
 Dockerfile           | 4 +---
 docker/entrypoint.sh | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index ec6f771d0..6170a24a3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -42,8 +42,7 @@ RUN mkdir -p /var/lib/biscuit/media /var/lib/biscuit/static /var/lib/biscuit/bac
 
 # Build messages and assets
 RUN python manage.py compilemessages; \
-    python manage.py yarn install; \
-    python manage.py collectstatic --no-input --clear
+    python manage.py yarn install
 
 # Clean up build dependencies
 RUN apt-get remove --purge -y \
@@ -57,7 +56,6 @@ RUN apt-get remove --purge -y \
     pip uninstall -y poetry; \
     rm -f /var/lib/apt/lists/*_*; \
     rm -rf /root/.cache; \
-    rm -rf biscuit/node_modules; \
     rm -rf /usr/local/lib/node_modules
 
 # Declare a persistent volume for all data
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 4dcf89fce..eb1668a08 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -19,6 +19,7 @@ done
 
 python manage.py flush --no-input
 python manage.py migrate
+python manage.py collectstatic --no-input --clear
 
 if [[ -n "$@" ]]; then
     exec "$@"
-- 
GitLab