Skip to content

Instantly share code, notes, and snippets.

@rxhl
Created September 5, 2021 14:58
Show Gist options
  • Save rxhl/80b3e13aadfa01ace5cce7441920f838 to your computer and use it in GitHub Desktop.
Save rxhl/80b3e13aadfa01ace5cce7441920f838 to your computer and use it in GitHub Desktop.
FROM python:3.8-slim
COPY ./requirements.txt /requirements.txt
COPY ./src /app
WORKDIR /app
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
/py/bin/pip install -r /requirements.txt && \
adduser --disabled-password --no-create-home django-user
ENV PATH="/py/bin:$PATH"
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
USER django-user
# Gunicorn as app server
CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 app.wsgi:application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment