28 lines
940 B
Docker
28 lines
940 B
Docker
|
# syntax=docker/dockerfile:1
|
||
|
FROM python:3
|
||
|
ARG OPERATION
|
||
|
|
||
|
RUN useradd -d /code pathogen
|
||
|
RUN mkdir -p /code
|
||
|
RUN chown -R pathogen:pathogen /code
|
||
|
|
||
|
RUN mkdir -p /conf/static
|
||
|
RUN chown -R pathogen:pathogen /conf
|
||
|
|
||
|
RUN mkdir /venv
|
||
|
RUN chown pathogen:pathogen /venv
|
||
|
|
||
|
USER pathogen
|
||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||
|
ENV PYTHONUNBUFFERED=1
|
||
|
WORKDIR /code
|
||
|
COPY requirements.txt /code/
|
||
|
RUN python -m venv /venv
|
||
|
RUN . /venv/bin/activate && pip install -r requirements.txt
|
||
|
|
||
|
# CMD . /venv/bin/activate && uwsgi --ini /conf/uwsgi.ini
|
||
|
|
||
|
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
|
||
|
# CMD . /venv/bin/activate && gunicorn -b 0.0.0.0:8000 --reload app.asgi:application -k uvicorn.workers.UvicornWorker
|