Skip to content

Instantly share code, notes, and snippets.

@cse031sust02
Last active June 2, 2024 09:39
Show Gist options
  • Save cse031sust02/f149d809d50116e7890691d73922d379 to your computer and use it in GitHub Desktop.
Save cse031sust02/f149d809d50116e7890691d73922d379 to your computer and use it in GitHub Desktop.
Basic Dockerfile for Django using Pipenv
# My Django Project
# Version: 1.0
# FROM - Image to start building on.
FROM python:3
# PROJECT SETUP
# ----------------
# sets the working directory
WORKDIR /usr/src/django-docker
# copy these two files from <src> to <dest>
# <src> = current directory on host machine
# <dest> = filesystem of the container
COPY Pipfile Pipfile.lock ./
# install pipenv on the container
RUN pip install -U pipenv
# install project dependencies
RUN pipenv install --system
# copy all files and directories from <src> to <dest>
COPY . .
# RUN SERVER
# ------------
# expose the port
EXPOSE 8000
# Command to run
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
@tarikwaleed
Copy link

@cse031sust02
Thanks for sharing this gist ❤️

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