2
0
Fork 0

Add entrypoint script

This commit is contained in:
Luca 2022-04-18 22:48:36 +02:00
parent 5077333ff1
commit 94b5638982
2 changed files with 21 additions and 2 deletions

View File

@ -8,8 +8,7 @@ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
COPY . . COPY . .
RUN python manage.py collectstatic
EXPOSE 8000 EXPOSE 8000
ENTRYPOINT ["gunicorn", "shiftregister.wsgi", "-b", "0.0.0.0:8000"] ENTRYPOINT ["/opt/shiftregister/entrypoint.sh"]

20
entrypoint.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
ROLE="${ROLE:-app}"
case "$ROLE" in
app)
python manage.py collectstatic
python manage.py migrate
gunicorn shiftregister.wsgi -b 0.0.0.0:8000 "$@"
;;
worker)
celery -A shiftregister worker -B
;;
*)
echo 'unknown role "'"$ROLE"'"' >&2
sleep 1
;;
esac