Skip to content

Instantly share code, notes, and snippets.

@jensneuhaus
Created August 29, 2019 10:51
Show Gist options
  • Select an option

  • Save jensneuhaus/f8ee4e6bafe0dc2d807637143683d686 to your computer and use it in GitHub Desktop.

Select an option

Save jensneuhaus/f8ee4e6bafe0dc2d807637143683d686 to your computer and use it in GitHub Desktop.
A more simple Dockerfile
# 1 Use the Python Slim
FROM python:3.7-slim
# 2 Force stdin, stdout and stderr to be totally unbuffered and don´t write .pyc or .pyo files
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
# 3 Create the Working dir and the staticfiles folder
RUN mkdir -p /app \
&& mkdir -p /venv \
&& mkdir -p /app/staticfiles
# 4 Copy some required files
COPY Pipfile Pipfile.lock
# 5 Copy the App
COPY . /app/
# 6 user django is the owner
RUN chown -R django /app
# 7
WORKDIR /app
# 8 Run as django user
USER django
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment