3) add a new config layer in your dockerfile which copy the file to the /etc/nginx
4) use this new layer and copy build application to the destination and start nginx deamon
Hi, I'm Raja, a software engineer with a passion for learning new things. I have experience in developing web applications using .NET, JavaScript, React, Angular, and DevOps
Thank you for sharing this amazing tutorial on how to dockerize a React application. Your step-by-step guide was very easy to follow and helped me understand the process better.
docker build -t docker-react-image:1.0 .
How to change this tag value for next build dynamically?
I appreciate the time and effort you put into creating this post. Keep up the great work!
Hi, I'm Raja, a software engineer with a passion for learning new things. I have experience in developing web applications using .NET, JavaScript, React, Angular, and DevOps
I cut my first commercial code (Telcomp) at Time Sharing Ltd in the UK. I'm long since retired but remain fascinated by software development technologies.
👋Pierre-Henry, a passionate Sr AI Software Engineer 😎 I create cool stuff (https://github.com/Lifyzer & https://github.com/pH7Software), love problem-solving, eating veggies, & developing new skills
This was awesome. I have a couple of friends who talk a lot about using Docker and I never fully understood how it functioned. This has given me a solid foundation to work from, thanks for this!
I am missing the nginx configuration for URL based routing.
Since this is a basic guide, I haven't included that part. But you can follow the below steps to achieve that.
1) Create an NGINX configuration file (nginx.conf) in the same directory as your Dockerfile.
2) Add below code as the nginx configuration
3) add a new config layer in your dockerfile which copy the file to the /etc/nginx
4) use this new layer and copy build application to the destination and start nginx deamon
Thank you for sharing this amazing tutorial on how to dockerize a React application. Your step-by-step guide was very easy to follow and helped me understand the process better.
docker build -t docker-react-image:1.0 .
How to change this tag value for next build dynamically?
I appreciate the time and effort you put into creating this post. Keep up the great work!
Thank you for your comment.
You can pass the build id or commit hash to the tag value.
Get the current Git commit hash
COMMIT_HASH=$(git rev-parse --short HEAD)Build the Docker image with the commit hash as the tag
docker build -t docker-react-image:$COMMIT_HASH .Note that this is the way you should do when we are using a service like Azure DevOps or GitHub Actions.
I used terminal to run the command since this is basic guide.
Thanks, got it !
Thanks Ayesh - that's very helpful.
Thank you!
Excellent article Ayesh! Great share 👌
Thank you!
This was awesome. I have a couple of friends who talk a lot about using Docker and I never fully understood how it functioned. This has given me a solid foundation to work from, thanks for this!
I'm glad that this gives you an idea of Docker. Keep crushing
Why use Docker for a React app when its output is just static files that you can easily host on any CDN? 🤔