To read more articles like this, visit my blog
If you are working in web development, then you probably already know about the idea of containeriz...
For further actions, you may consider blocking this person and/or reporting abuse
Hello Faisal,
Really insightful blog post. I just got a chance to work with docker and some parts are easy and other parts are bit difficult for me.
I have few questions here:
1) After building the second image in the multi stage containerization, will the first image get discarded automatically?
2) Why is that the node server is not good for serving static content? Why is Nginx preferred? Is it because Nginx is good for production.
Thank you.
good practice.
I have never thought about to wrap nginx in an app level container, but it does offer a good option to optimise web app docker size
Right. It's probably better to use s3 or something to host a simple static site.
But if you go down the docker path, nginx is the best choice.
Interesting and helpfull article. But there's a trick here that's more React then Docker: you move from a development build on step3 wich is built focused on Dev Experience (with Hot Reload and more), to a production build on step4 that serves the static files and minified JS that is way smaller.
The thing is they serve different proposals:
The first dockerfile can be used so every developer can run it on their machines with the same environment without installing anything apart from Docker
The second dockerfile is focused on serving the final content to production
Great Article 🧡👍
Awesome thank you.
Nice post, thank you for sharing
Nice post! I never compare docker container size this way before ❤️
I was thinking that is what everyone was doing using nginx to serve ReactJS application usign nodejs is definitely an overkill and I never tried using it for statics websites. Nginx containers are so light you can run many containers in on raspberry pi you could host your websites from home when you are starting with new applications.
Well.... now you know :P
Interesting article!
I was wondering that can the size of the docker image with
yarn start
be reduced without making a build?Nice post! I hope you could try this idea for your next blog post.
Use Node v20 to build a single executable of your app and then use scratch for the base image in the second stage
good