Project: Building and Deploying Docker Image for React-Django Demo Web App

Docker:
- Docker is a platform that allows developers to build, package, and deploy applications as lightweight, portable containers. Docker containers are similar to virtual machines, but they are more lightweight and efficient, as they share the underlying operating system kernel of the host machine.
Below is the step-by-step demonstration of the project:
Install Jenkins.
Clone your app from GitHub
$ git clone <project repository URL>

- Create Dockerfile ( We need to check the requirement and create accordingly)

$vim Dockerfile
-----------------------------------------------------------------
Inside editor
-----------------------------------------------------------------
FROM python:3.9 \\to obtain base image of python (3.9)
COPY . . \\copy code from current directory(where code is available) to
same container
RUN pip install -r requirements.txt \\to install the reqiured apps from
reuirement file
CMD ["python","manage.py","runserver","0.0.0.0:8000"] \\to run django
development server
:wq
- Now, we have to build an image from the docker file.
$docker build . -t react-django-app:latest \\ -t <name> (to give img name)


- Let's check if the image is created.
$docker images

- Now, we have to create a container from the image.
$docker run -d -p 8000:8000 react-django-app:latest \\8000:8000(mapping our port with container port)

Let's check our container status.
$docker ps

- Our react-django app is created and running on port 8000.

Now, we have to open our port as it won't be accessible due to security reasons.
Go to our server on AWS < security < security group <edit inbound rules.


- We have to open incoming traffic through an inbound rule.

Add a new rule and give custom TCP to our port 8000 and allow from anywhere as shown above.
Now let's check the web page (http://13.53.45.84:8000/).

Our web app is up and running as shown above.
The web app is successfully deployed using Docker.




