o2r-project / o2r-UI

User interface for creating and examining Executable Research Compendia (ERC)
https://o2r.uni-muenster.de/
Apache License 2.0
3 stars 5 forks source link

Add production app build in main Dockerfile #58

Open nuest opened 4 years ago

nuest commented 4 years ago

The Dockerfile.dev can use the development server, but the production image should have a prebuild app, not the least for reasons of performance:

Related to #57

nuest commented 3 years ago

Use a multi-stage build to finally have an nginx-based image: https://docs.docker.com/develop/develop-images/multistage-build/

Fmazin commented 3 years ago

I have encountered a problem while fixin this issue.

I have created a multistage Dockerfile using nginx. And works in creating a production build And then deploying it with nginx.

At the moment it looks like this:

Bildschirmfoto von 2021-01-11 09-49-24

But when i start up the docker compose command. The ui container seems to be unable to the communicate to with the rest of the microservices. I get a 502 Bad Gateway when tying to access the usual localhost Port.

In the Terinal this error is thrown:
webserver_1 | 2021/01/11 08:41:55 [error] 30#30: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.18.0.5:3000/favicon.ico", host: "localhost", referrer: "http://localhost/"

The problem seems to be that something in the internal routing is not working. I have tried a few things with different ports and the nginx.conf file. But nothing worked.

nuest commented 3 years ago

Please commit your changes to a branch and open a work-in-progress pull request. Looking at screenshots of files makes it very hard to look at problems.

Also: Do you have no problems with the regular docker-compose configuration? Did you do a docker-compose down -v --rmi all to be sure that there are no mix-ups with the existing images of the compose configuration?