2022-10-13 14:26:43 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
FROM python:3
|
2022-10-18 06:22:22 +00:00
|
|
|
ARG OPERATION
|
2022-10-13 14:26:43 +00:00
|
|
|
|
2023-07-06 16:11:02 +00:00
|
|
|
RUN useradd -d /code xf
|
2023-07-29 16:28:12 +00:00
|
|
|
RUN mkdir -p /code
|
2022-10-15 21:41:41 +00:00
|
|
|
RUN chown -R xf:xf /code
|
2022-10-13 14:26:43 +00:00
|
|
|
|
2022-10-15 21:49:33 +00:00
|
|
|
RUN mkdir -p /conf/static
|
2022-10-15 21:55:57 +00:00
|
|
|
RUN chown -R xf:xf /conf
|
2022-10-13 14:26:43 +00:00
|
|
|
|
|
|
|
RUN mkdir /venv
|
|
|
|
RUN chown xf:xf /venv
|
|
|
|
|
|
|
|
USER xf
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /code
|
2023-07-29 16:28:12 +00:00
|
|
|
COPY requirements.txt /code/
|
2022-10-13 14:26:43 +00:00
|
|
|
RUN python -m venv /venv
|
2022-10-18 06:22:22 +00:00
|
|
|
RUN . /venv/bin/activate && pip install -r requirements.txt
|
|
|
|
|
2022-10-13 14:26:43 +00:00
|
|
|
# CMD . /venv/bin/activate && uwsgi --ini /conf/uwsgi.ini
|
2022-10-18 06:22:22 +00:00
|
|
|
|
|
|
|
CMD if [ "$OPERATION" = "uwsgi" ] ; then . /venv/bin/activate && uwsgi --ini /conf/uwsgi.ini ; else . /venv/bin/activate && exec python manage.py runserver 0.0.0.0:8000; fi
|
|
|
|
|
|
|
|
# CMD . /venv/bin/activate && uvicorn --reload --reload-include *.html --workers 2 --uds /var/run/socks/app.sock app.asgi:application
|
2023-07-29 16:28:12 +00:00
|
|
|
# CMD . /venv/bin/activate && gunicorn -b 0.0.0.0:8000 --reload app.asgi:application -k uvicorn.workers.UvicornWorker
|