From d669200cc25e1ecd224ae83ac2b59de889923498 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 5 Jun 2024 11:37:28 +0100 Subject: Adds docker-entrypoint script --- Dockerfile | 5 +++-- docker-entrypoint.sh | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index b1e06d7..103b14e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ ENV DJANGO_SETTINGS_MODULE=conf.settings.prod # Install Python dependencies RUN pip install -U "pip>=24.0.0" && \ pip install -r requirements.txt && \ - python manage.py collectstatic --noinput RUN mkdir -p /app/static/css /app/static/js /app/static/img @@ -25,4 +24,6 @@ RUN mkdir -p /app/static/css /app/static/js /app/static/img USER 1001 # Start app -CMD ["gunicorn", "ded.wsgi:application", "--bind", "0.0.0.0:8000"] + +RUN chmod +x docker-entrypoint.sh +ENTRYPOINT ["/app/docker-entrypoint.sh"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..93c5459 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +cd /app +python manage.py migrate +python manage createsuperuser --noinput +python manage.py collectstatic --noinput +exec gunicorn --bind ':8080' --workers 3 config.wsgi:application -- cgit v1.2.3