Project : App Deployment Using   Docker for React and Django

Project : App Deployment Using Docker for React and Django

Complete Steps by Steps instructions with Hands-On

Launched an EC2 instance on AWS and installed Ubuntu and Update it

apt-get update

Install Docker into Local system

apt-get install Docker.io

Now Check Docker status

service docker status

Create A Directory go inside it

mkdir <directory_name>
cd <directory_name>

Do Git Clone for deployment

git clone <repo_url>
repo_url <https://github.com/meet003/react_django_demo_app.git>

Now do cd command to change Directory then ls Command and Create Dockerfile using vim command

cd <project_name>
ls
vim Dockerfile

Inside the Dockerfile write all dependency

FROM python:3.9
COPY . .
RUN pip install -r requirements.txt
EXPOSE 8000
CMD ["python","manage.py","runserver","0.0.0.0:8000"]

Now time to execute the Dockerfile and Create Images form Dockerfile

docker build . -t <new_image_name>

Now Check Docker Images

docker images

Now Create a Container From Docker New Image and mapped the port with 8001

docker run -d -p port:port <image_name>

Now open AWS account go to instances click on instances I which you are performing go to security>security groups>edit inbound rules then

Click to add rule to create new inbound rules for incoming traffic in custom tcp on port no. 8000 from source anywhere

Now Copy The PubliC Ip Of Ec2

Now Hit copy Ip address to Google with port [eg: <ip_address:8000>] Now our Task is working

Now Push This container To Docker-Hub

Now check Docker Container and Check Docker Image

docker ps -a
docker images

Create Account on Docker-Hub website

Now Login Docker-Hub with user name and password

docker login

Give a tag to these images

docker tag <images_name> <docker-Hub_user_id>/<tag_name>

Push the Docker image to Docker Hub using the docker push command.

docker push <image_name> <docker-Hub_user_id>/<tag_name>

Now verify it with your docker hub account:

Finally our Image push to Docker Hub

Login Docker Hub

Thanks for Reading