angular not finding resources when deployed inside nginx using Docker

I am trying my hands on Docker and Nginx to deploy my angular app, however, I am facing a problem.

When I run the command: npm run build, my index.html has the following script references:

  <script type="text/javascript" src="runtime.js"></script>
  <script type="text/javascript" src="polyfills.js"></script>
  <script type="text/javascript" src="styles.js"></script>
  <script type="text/javascript" src="vendor.js"></script>
  <script type="text/javascript" src="main.js"></script>

From what I feel, these are relative paths, and hence when nginx starts, and my index.html is inside firstApp, then on accessing these files the resource URL should be created as:


but when I run the application in browser, I get 404 error, as Nginx is trying to find the resource at:


Is there a way to fix this issue?

Source: StackOverflow