From 1407ed37666d60bb27f964feeabadb8f5ca07cd8 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 5 Jun 2024 16:37:49 +0100 Subject: Experiment with putting collectstatic and superuser in initial build --- Dockerfile | 8 +++++--- docker-entrypoint.sh | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20b1caf..096ddb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,11 +14,13 @@ COPY . /app ENV DJANGO_SETTINGS_MODULE=conf.settings.prod +RUN mkdir -p /app/static/css /app/static/js /app/static/img + # Install Python dependencies RUN pip install -U "pip>=24.0.0" && \ - pip install -r requirements.txt - -RUN mkdir -p /app/static/css /app/static/js /app/static/img + pip install -r requirements.txt && \ + python manage.py collectstatic --noinput && \ + python manage.py createsuperuser --noinput # Switch to non-root user USER 1001 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2b17530..6c3efca 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -6,7 +6,7 @@ python manage.py migrate # Try to create a superuser, skip if email is already taken echo "Attempting to create superuser..." -python manage.py createsuperuser --noinput || true +#python manage.py createsuperuser --noinput || true # Collect static files #python manage.py collectstatic --noinput -- cgit v1.2.3