Тёмный

Deploy React App in Docker using Nginx 

Aveti Tutorials
Подписаться 193
Просмотров 15 тыс.
50% 1

This tutorial shows deploying React app with Nginx in Docker. This approach can be used to dockerize react app in production environment with docker. It uses docker multistage build to build docker image.
Prerequisites
Nodejs installed, Docker installed, docker-compose installed
IDE:
Visual Studio code
Steps
Stage 1: Create docker image for react application
Stage 2: Create nginx react app image uisng base image nginx:alpine
1. Create a react application or clone from github.com/ave...
2. Create docker file
3. Create Docker compose file
4. Deploy react using Nginx server in docker
Build image:
docker-compose build
Deploy App:
docker-compose up
For Detached Mode deployment
docker-compose up -d
For source code clone:
Git Hub: github.com/ave...
Facebook : / aveti.tutorial.9
Please subscribe to this channel

Опубликовано:

 

16 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 22   
@edlingaon
@edlingaon 2 года назад
Thanks so much, man!! These stills keep helping so many people! You've got yourself another subscriber! :D
@avetitutorials4200
@avetitutorials4200 2 года назад
Thanks Edlingao for your valuable feedback. Great for encouragement.🙂
@himansusekharmishra5114
@himansusekharmishra5114 2 года назад
Can we put both the react js and nginx image in a single docker file and pushed it to AWS ECR, because I have tried the same and ended with a single image works.
@avetitutorials4200
@avetitutorials4200 2 года назад
Yes you can use this approach
@himansumishra7022
@himansumishra7022 2 года назад
@@avetitutorials4200 but two images are not working in a single ecr container..
@sanjeevkumarpatil9276
@sanjeevkumarpatil9276 2 года назад
It really helped me for deployment and thankyou so much, great work keep growing 🙏🏻
@avetitutorials4200
@avetitutorials4200 2 года назад
Glad to hear that Sanjeev Thanks a lot. It boosts up to create new tutorials. Please like and subscribe and let me know for tutorials on other topics.
@sanjeevkumarpatil9276
@sanjeevkumarpatil9276 2 года назад
@@avetitutorials4200 can u upload a video on how to create dockerfile for html,css and javascript it will be helpful
@avetitutorials4200
@avetitutorials4200 2 года назад
For a react app, the build process automatically copies all css,javascript and html and puts in build directory. If you want to explicitly copy html css, here's is a Sample Dockerfile #base image FROM node #Make A directory inside docker image RUN mkdir /usr/src/app/css #Copy your css or html content COPY ./css /usr/src/app/css #other copy or mkdir commands for image can be put here RUN yarn # start app CMD ["npm", "start"]
@sanjeevkumarpatil9276
@sanjeevkumarpatil9276 2 года назад
@@avetitutorials4200 thank you how can i connect with u insta id ?
@avetitutorials4200
@avetitutorials4200 2 года назад
You can comment here, I ll try to resolve your queries.
@levinbraun3475
@levinbraun3475 8 часов назад
Why ENTRypoint?
@atkn007
@atkn007 2 года назад
How can I deploy to aws lightsail?
@avetitutorials4200
@avetitutorials4200 2 года назад
Hi Atix, thanks for your feeback and question. You can use the image built here to deploy in aws lightsail. Please follow the steps below Push image to docker hub 1. Create docker image with the docker-compose.yml given in the tutorial docker-compose build 2. Push image to docker hub. You need create a docker hub account to push image. a)docker login --username username . provide password on promt b)docker tag aveti-react-docker-starter_react-app YOUR_DOCKERHUB_NAME/aveti-react-docker-starter_react-app c)docker push YOUR_DOCKERHUB_NAME/aveti-react-docker-starter_react-app d)Use this image (aveti-react-docker-starter_react-app) in awss lightsail service in next steps Create Container Service in aws lightsail 1. Go to aws lighsail 2. Create container service 3. Choose aws region for deployment 4. Choose container capacity 5. Go to set up deployment 6. Give name for your container service 7. Click create new container service Deploy an Application in aws lightsail 1. Go to your service 2. Click deployment tab 3. Give container name 4. Give image name you pushed to docker hub 5. Add container entry for public endpoint, select your container
@atkn007
@atkn007 2 года назад
@@avetitutorials4200 oh wow. Thank you do much for the detailed answer
@avetitutorials4200
@avetitutorials4200 2 года назад
Cool , Thanks Atix for your wonderful review and feedback. Let me know for any queries.
@MarcosRCordeiro10
@MarcosRCordeiro10 2 года назад
Congratz!!! Great tutorial!!!
@avetitutorials4200
@avetitutorials4200 2 года назад
Thanks a lot for your feedback
@imransaid1026
@imransaid1026 2 года назад
Top video. Very informative. Could you do a similar video for nginx, react and flask (or any other api framework) with Docker?
@avetitutorials4200
@avetitutorials4200 2 года назад
Thanks Imran for great feedback. Sure will make videos for react and flask.
@mutolibsodiq3437
@mutolibsodiq3437 2 года назад
my image is loading 403 page
@avetitutorials4200
@avetitutorials4200 2 года назад
Please check if version for nginx and is configured correctly.
Далее
Deploy a React App using Nginx
13:31
Просмотров 73 тыс.
The intro to Docker I wish I had when I started
18:27
Просмотров 160 тыс.
Deploying A React App To Docker | Become A React Pro
35:52
How To Deploy A React App - Using NGINX & Linux
23:09
Nginx inside Docker Container
7:45
Просмотров 102 тыс.