ref-idp-server icon indicating copy to clipboard operation
ref-idp-server copied to clipboard

Issue with building Dockerimage

Open CWeykopf opened this issue 3 years ago • 8 comments

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.34.1:build (default) on project idp-server: Configured Dockerfile "/Users/chris/Entwicklung/DEOS/E-Rezept/ref-idp-server/idp-server/target/tmpdocker/Dockerfile" (resolved to "/Users/chris/Entwicklung/DEOS/E-Rezept/ref-idp-server/idp-server/target/tmpdocker/Dockerfile") doesn't exist -> [Help 1]

macOS 11.6 openjdk 11.0.2 Apache Maven 3.8.2 Docker version 20.10.8, build 3967b7d

Any hints?

CWeykopf avatar Oct 22 '21 08:10 CWeykopf

hmm, works on my machine :D what goals did you execute? (I actually use pretty much the same setup, the only difference being java 12, but that sounds rather unlikely)

Arkinator avatar Oct 23 '21 17:10 Arkinator

First to say, I have no experience with Java nor Maven.

I retried to build with Java 13.0.1 without success. To build I followed the instructions in the Readme. man clean compile rund successful. mvn install fails with the Docker error. The tests run without error. Also mvn test runs fine.

docker-compose build --build-arg mode=tested fails also but with an other error. Building idpserver [+] Building 0.0s (1/2)
=> [internal] load build definition from Dockerfile => => transferring dockerfile: 2B failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount998915947/Dockerfile: no such file or directory ERROR: Service 'idpserver' failed to build : Build failed

There is no /var/lib/docker directory. The Docker runs fine with other images.

CWeykopf avatar Oct 25 '21 08:10 CWeykopf

I'm very much surprised that Arkinator has a working docker compose part on his machine (linux?) there are necessary files missing on github like idp-server/buildDockerImage.sh idp-server/deleteDockerImage.sh idp-server/Dockerfile at least the dockerfile would be useful ;-)

Kgessner avatar Nov 02 '21 08:11 Kgessner

I see the same errors, the files are just missing in the repo - can you maybe add the Dockerfile @Arkinator? According to the idp-server/pom.xml -> maven-resource-plugin they should be located in ${basedir}/src/main/docker.

DaMo86 avatar Jul 22 '22 07:07 DaMo86

The file was stripped during the release to github due to internal information being present. I'm sorry about that. I'm no longer with the team but I'll adress the issue.

The dockerfile itself is really nothing special, the following might be a good starting point:

FROM adoptopenjdk/maven-openjdk11:latest
RUN mkdir /app
COPY /target/idp-server*.jar /app/idp-server.jar
WORKDIR /app
HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health | grep UP || exit 1
CMD ["java", "-jar", "idp-server.jar"]

Arkinator avatar Jul 22 '22 07:07 Arkinator

Thank you for the fast reply!

I was able to build the system with a slight change (the .jar is already copied to the tmpDocker folder, so no target necessary): COPY ./idp-server*.jar /app/idp-server.jar

I created 4 similiar Dockerfiles, which copying the corresponding artifact (e.g. idp-sektoral*.jar, idp-server*.jar, ...): grafik

DaMo86 avatar Jul 22 '22 08:07 DaMo86

I also found the overall problem: looks like everything about Docker is ignored in .gitignore

DaMo86 avatar Jul 22 '22 08:07 DaMo86

There is an image available on docker hub as well: https://hub.docker.com/r/gematik1/idp-server/

RStaeber avatar Dec 05 '22 08:12 RStaeber