Consider a docker image containing a React UI
and a Spring REST app
. I'd like to deploy this to Azure web app for containers, where the URL for the instance hits the UI
which is being statically served on port 5000
while the Spring app
is listening on 8080
. The UI
communicates with the Spring app
via HTTP, hence the requests made by the UI
to the Spring app
are evaluated on the user's machine (i.e. can't access the Spring app
via localhost:8080
). However, port 8080
is not mapped in the default run command. Another issue is that there is only one URL for the web app.
The default run command is: (from logging in via FTP and examining docker logs)
docker run -d -p <WEB_APP_PORT>:<UI_PORT> --name ... -e ... <IMG>
Can I run a custom docker run
command to expose the UI_PORT
and the SPRING_PORT
and also set up one web app with two URLs?
If not, are there alternative solutions?
For context:
The final image is built by extending an image which contains only the
Spring app
(i.e.FROM openjdk:8-jdk-alpine
) and installing node and the UI.An
entrypoint.sh
script start both the UI and the SPRING APPThe ports exposed in the image are
8080
and5000
.A diagram of what I'm trying to achieve: