Correct me if I'm wrong.
What is the use of deploying nginx and app within the same container? Basically if you're using nginx for load balancing, then it has to be a separate container and the backend microservice can be replicated across machines as containers. So you can achieve load balancing across machines.
You are right! The app and load balancer would have a separate containers. In this case we don't have separate application, though.
In the Dockerfile RUN jekyll build generates static HTML pages, and in COPY --from=build-stage /usr/src/app/_site/ /usr/share/nginx/html we copy the generated pages for nginx to use. In nginx config, we tell nginx to serve those pages in
location / {
root /usr/share/nginx/html;
index index.html;
}
Correct me if I'm wrong.
What is the use of deploying nginx and app within the same container? Basically if you're using nginx for load balancing, then it has to be a separate container and the backend microservice can be replicated across machines as containers. So you can achieve load balancing across machines.
You are right! The app and load balancer would have a separate containers. In this case we don't have separate application, though.
In the Dockerfile
RUN jekyll build
generates static HTML pages, and inCOPY --from=build-stage /usr/src/app/_site/ /usr/share/nginx/html
we copy the generated pages for nginx to use. In nginx config, we tell nginx to serve those pages inThus, we don't need any other containers.
Did I answer to your question? 😊
Yes! Thanks 😀
Maybe I didn't go through the Dockerfile properly. For static sites this is a good approach.