mSorok / NaturalProductsOnline

Website code for COCONUT
https://coconut.naturalproducts.net/
33 stars 11 forks source link

Docker build failing #48

Closed oolonek closed 1 year ago

oolonek commented 3 years ago

Hi @mSorok

When trying to build the Docker image with docker-compose build I get the following error ERROR: Service 'natural-products-online' failed to build : COPY failed: no source files were specified

Would that be because the /target repo is in your .gitignore ?

mSorok commented 3 years ago

Hi @oolonek ,

Indeed, I forgot to write in the README that prior to running the docker, a jar should be generated with Maven. Adding the target folder is too heavy and is rejected by GitHub, unfortunately. I'll repair this, by adding the required command in the README.

Thank you for notifying this!

Kind regards, Maria

sneumann commented 3 years ago

Hi,

so the issue is that one does not want an 1.5GB docker image that includes the entire build environment and all mvn dependencies.

The simple option would be to RUN mvn build; cp arget/target/naturalproductsonline-*.jar app.jar; rm -rf target ~/.mvn because only that stuff still around in the filesystem at the END of the line makes it into the image.

The other option is to do a two-stage build. Here you first do a mvn build in a first image, and then COPY something from the first image into the second, and the first image can be deleted / ignored. As a bonus the second image can be FROM a JRE instead of the JDK, saving another ~40MB ;-)

Yours, Steffen