Skip to content

Instantly share code, notes, and snippets.

@ecelis
Last active June 3, 2020 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecelis/35d581704cba11ad5b741b79b895a199 to your computer and use it in GitHub Desktop.
Save ecelis/35d581704cba11ad5b741b79b895a199 to your computer and use it in GitHub Desktop.
Django Dockerfile
FROM python:3.8
COPY ./ /app
WORKDIR /app
RUN apt-get update -q && apt-get install -qy libmariadbclient-dev && \
pip install Django
CMD ["python", "manage.py", "runserver"]
@ecelis
Copy link
Author

ecelis commented Jun 3, 2020

Run

Create an empty directory and a Dockerfile within with the above contents. Build the mydjangoapp image and then start a new Django project.

docker build -t mydjangoapp .
docker run -it -v$(pwd):/app mydjangoapp django-admin startproject app
docker run -it -v$(pwd)/app:/app -p8000:8000 mydjangoapp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment