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
16 changes: 16 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build Image

on:
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --tag task:${{ github.actor }}
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG PYTHON_VERSION=3.10-slim

FROM python:${PYTHON_VERSION} AS builder

WORKDIR /app

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt

COPY . .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The INSTRUCTION.md file is missing the docker run command to run the container. According to requirements, this file must contain all instructions for building AND running the container.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The INSTRUCTION.md file is missing instructions on how to access the application via a browser. According to requirements, this file must contain instructions for accessing the app (e.g., http://localhost:8080).

RUN python manage.py migrate

FROM python:${PYTHON_VERSION} AS runner

WORKDIR /app
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker run command is corrupted - it appears merged with docker build on the same line. The line should only contain: docker run -p 8080:8080 todoapp. The docker build command should be removed as it's already in the Build Instructions section above.

Comment on lines +17 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing browser access instructions. Add Access the app at http://localhost:8080 after the run command (task item #14)

Comment on lines +17 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Docker Hub push instructions with 1.0.0 tag. Add a section with docker tag todoapp:latest tigerob/todoapp:1.0.0 and docker push tigerob/todoapp:1.0.0 commands (task item #10)


ENV PYTHONUNBUFFERED=1

COPY --from=builder /root/.local /root/.local
COPY --from=builder /app /app

ENV PATH=/root/.local/bin:$PATH

EXPOSE 8080

CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
20 changes: 20 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ToDo Application — Docker Instructions

This document provides complete instructions on how to build, run, and access the ToDo web application using Docker.

## Docker Hub Repository
The official pre-built image can be found on Docker Hub:
[https://hub.docker.com/r/tigerob/todoapp](https://hub.docker.com/r/tigerob/todoapp)

## Local Build Instructions

To build the Docker image locally, run the following command in the project root directory:

```bash
docker build -t todoapp .
```
## How to Run the Container

```bash
docker run -p 8080:8080 todoapp
Comment on lines +16 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing browser access instructions after the run command. Add Access the app at http://localhost:8080 to inform users how to access the application in their browser.

```
Comment on lines +16 to +20
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Docker Hub push instructions with the 1.0.0 tag. Add docker tag todoapp:latest tigerob/todoapp:1.0.0 followed by docker push tigerob/todoapp:1.0.0 to complete the instructions for pushing the image.

58 changes: 33 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
# Django-Todolist
# Django ToDo list

Django-Todolist is a todolist web application with the most basic features of most web apps, i.e. accounts/login, API and (somewhat) interactive UI.
This is a to-do list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. To do this task, you will need:

---
CSS | [Skeleton](http://getskeleton.com/)
JS | [jQuery](https://jquery.com/)
- CSS | [Skeleton](http://getskeleton.com/)
- JS | [jQuery](https://jquery.com/)

## Explore
Try it out by installing the requirements. (Works only with python >= 3.8, due to Django 4)

pip install -r requirements.txt
Try it out by installing the requirements (the following commands work only with Python 3.8 and higher, due to Django 4):

```
pip install -r requirements.txt
```

Create a database schema:

python manage.py migrate
```
python manage.py migrate
```

And then start the server (default: http://localhost:8000)
And then start the server (default is http://localhost:8000):

python manage.py runserver
```
python manage.py runserver
```

You can now browse the [API](http://localhost:8000/api/) or start on the [landing page](http://localhost:8000/).

Now you can browse the [API](http://localhost:8000/api/)
or start on the [landing page](http://localhost:8000/)
## Task

## Task
Create a Dockerfile for the TODO app:
- TODO App should start inside a container without an error
- Dockerfile should contain the build stage and run stage
- Add ARG to be used as python base image version in dockerfile
- Execute db migration as RUN instruction
- Add ENV variable `ENV PYTHONUNBUFFERED=1`. This is needed for optimisation of python app for docker (writing logs directly to stdout and stderr without buffering in the app process memory
- `runserver` should be followed by `0.0.0.0:8080` parameter to properly start Django server
- Build an image and name it todoapp
- An image should be pushed to your personal docker hub account into a repository named “todoapp”, with a tag 1.0.0 (todoapp:1.0.0)
- README.md should contain all the instructions on how to build and run the container.
- README.md should contain instructions on how to access the application via a browser.
- Create PR with your changes and attach it for validation on a platform
Create a `Dockerfile` for the ToDo app:

1. Fork this repository.
1. The ToDo app should start inside a container without an error.
1. `Dockerfile` should contain the build stage and run stage.
1. Add `ARG` as Python base image version in `Dockerfile`.
1. Execute database migration as `RUN` instruction.
1. Add the `ENV PYTHONUNBUFFERED=1` variable to optimize the Python app for Docker (writing logs directly to `stdout` and `stderr` without buffering in the app process memory.
1. `runserver` should be followed by the `0.0.0.0:8080` parameter to start the Django server properly.
1. Build an image and name it `todoapp`.
1. The image should be pushed to your personal Docker Hub account into the `todoapp` repository with the `1.0.0` tag (`todoapp:1.0.0`).
1. Create the `INSTRUCTION.md` file
1. `INSTRUCTION.md` should contain a link to your personal Docker Hub repository win an app image.
1. `INSTRUCTION.md` should contain all the instructions for building and running the container.
1. `INSTRUCTION.md` should contain instructions on accessing the application via a browser.
1. Create PR with your changes and attach it for validation on a platform.
Loading