'Laravel mix-manifest docker nginx container and php container

I would like to understand how a nginx container processes css and js files with a php container.

We build 2 docker images for production. For each the nginx and php container we run RUN npm ci && npm run prod within the container image build.

If we launch the containers on ECS they render fine and my my source tab looks like the following:

enter image description here

which is 100% for cache busting.

Things i dont understand:

  1. If i remove the RUN npm ci && npm run prod command from the nginx container and launch to production i just get a white page and my source looks like this:

enter image description here

  1. If i keep RUN npm ci && npm run prod for my nginx container but leave out the RUN npm ci && npm run prod from the php container and launch the images to production my website launches fine but i lose the versioning on my files and my source looks like this:

enter image description here

I want to know why this happens and what role does nginx take part in because in my config for nginx it handles all php related files so i wanted to know why php cant handle the versioned builds by itself or visa-versa.

Hope this makes sense. Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source