docker enhancements
This commit is contained in:
parent
873fcd986c
commit
115a23592c
14
Dockerfile
14
Dockerfile
@ -1,6 +1,6 @@
|
||||
FROM python:3.11
|
||||
FROM python:3.11.4-slim-buster
|
||||
|
||||
# set environment variables
|
||||
# python related environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
@ -11,13 +11,13 @@ COPY requirements.txt /app/
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# setup entrypoint file
|
||||
COPY ./scripts/entrypoint.sh .
|
||||
RUN chmod +x /app/scripts/entrypoint.sh
|
||||
|
||||
COPY . /app/
|
||||
|
||||
# running migrations
|
||||
RUN python manage.py migrate
|
||||
|
||||
# collect static
|
||||
RUN python manage.py collectstatic
|
||||
ENTRYPOINT ["/app/scripts/entrypoint.sh"]
|
||||
|
||||
# gunicorn
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "core.wsgi:application"]
|
||||
|
8
scripts/entrypoint.sh
Executable file
8
scripts/entrypoint.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
RUN python manage.py collectstatic
|
||||
|
||||
python manage.py flush --no-input
|
||||
python manage.py migrate
|
||||
|
||||
exec "$@"
|
@ -1,5 +0,0 @@
|
||||
echo migrating
|
||||
python manage.py migrate
|
||||
|
||||
echo running without reload
|
||||
python manage.py runserver 0.0.0.0:8000 --noreload
|
Loading…
x
Reference in New Issue
Block a user