Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
34 changes: 34 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -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/
Loading