From 9faf762224d1ede208aa4d88d2d970952e6ef457 Mon Sep 17 00:00:00 2001 From: Dana Lambert Date: Thu, 7 Oct 2021 09:00:27 +1300 Subject: [PATCH] Create default django admin user on start up --- backend/Dockerfile | 4 ++++ docker-compose.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/backend/Dockerfile b/backend/Dockerfile index e9af939..850475b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,9 @@ FROM python:3.8-slim-bullseye +ENV DJANGO_SUPERUSER_USERNAME=admin +ENV DJANGO_SUPERUSER_EMAIL=admin@admin.com +ENV DJANGO_SUPERUSER_PASSWORD=admin + WORKDIR /app COPY ./requirements.txt /app/requirements.txt diff --git a/docker-compose.yaml b/docker-compose.yaml index c68f1c0..440cc6a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -19,6 +19,7 @@ services: - "8000:8000" command: bash -c "./manage.py makemigrations; ./manage.py migrate; + ./manage.py createsuperuser --noinput; ./manage.py runserver 0.0.0.0:8000" react-frontend: