diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5533eeb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +ARG PY_VER=3.8 + +FROM python:${PY_VER}-slim as builder + +WORKDIR /install + +COPY requirements.txt requirements.txt +RUN pip install --upgrade pip && \ + pip wheel --wheel-dir /wheels -r requirements.txt + +FROM python:${PY_VER}-slim + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +WORKDIR /app + +COPY --from=builder /wheels /wheels + +COPY requirements.txt . +RUN pip install --no-index --find-links=/wheels -r requirements.txt + +COPY . . + +RUN python manage.py migrate + +EXPOSE 8080 + +ENTRYPOINT [ "python", "manage.py", "runserver" ] +CMD [ "0.0.0.0:8080" ] diff --git a/INSTRUCTION.md b/INSTRUCTION.md new file mode 100644 index 0000000..183035b --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,34 @@ +# Django ToDo list + +This is a to-do list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. + +## Docker Hub image + +https://hub.docker.com/repository/docker/justoleja9/todoapp + +## Build the image + +```bash +docker build --build-arg PY_VER=3.8 -t todoapp:1.0.0 . +``` + +## Run the container + +```bash +docker run -p 8080:8080 todoapp:1.0.0 +``` + +## Push to Docker Hub + +```bash +docker login +docker tag todoapp:1.0.0 justoleja9/todoapp:1.0.0 +docker push justoleja9/todoapp:1.0.0 +``` + +## Access the application + +Open your browser and go to: + +- http://localhost:8080/ +- API: http://localhost:8080/api/