Created
July 11, 2018 20:39
-
-
Save dcwatson/a55f1217553c28d1dc6248c26b26bc51 to your computer and use it in GitHub Desktop.
Django Dockerfile example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3-slim | |
ENV LANG=C.UTF-8 \ | |
PYTHONUNBUFFERED=1 \ | |
DJANGO_SETTINGS_MODULE=project.settings.docker | |
COPY requirements.txt /app/ | |
RUN pip install --no-cache-dir -Ur /app/requirements.txt | |
COPY . /app | |
RUN set -x && \ | |
mkdir -p /data && \ | |
python /app/manage.py collectstatic --noinput && \ | |
useradd -g root -MN app && \ | |
chown -R app:0 /app /data && \ | |
chmod g+s /app /data | |
WORKDIR /app | |
USER app | |
VOLUME ["/data"] | |
EXPOSE 8000 | |
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "--access-logfile", "-", "project.wsgi"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment