Skip to content

Instantly share code, notes, and snippets.

@ecelis

ecelis/Dockerfile

Last active Jun 3, 2020
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@ecelis 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