Nginx routes request to a docker container

Hi, my system is described as following picture:

I use Drone runner docker to build and then run a Java process inside that container, which listens on port 8080. This port is blocked from outside by the host iptables and I want to use nginx to route HTTP requests to myapp.com to 8080 of the above container.

Question 1:
Is this approach correct?

Question 2:
If it is ok with above solution, how can I configure nginx to pass requests? because the container name is randomly generated by Drone, and its IP address is also dynamic.

{
    // ...
    server_name myapp.com;
    location / {
        proxy_pass WHERE/WHAT TO PASS HERE :8080;
    }
}

Thank you!

@mrloyal,

Could you please specify your use case, As by default the build will run by launching a container and as soon as the pipeline completes the container is destroyed.
So are you deploying as part of your ci pipeline?

Regards,
Harness support