eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
428 stars 179 forks source link

[BUG] Build Process for docker image not working. #3707

Closed ambs closed 3 years ago

ambs commented 3 years ago

Describe the bug The build process for creating the docker image is not working (cd exist-docker && mvn docker:build)

Expected behavior To work out of the box, creating automatically the docker image.

To Reproduce 1) Clone repository 2) cd exist-docker 3) mvn -DskipTests -Ddocker.tag=latest -Ddocker.username=admin -Ddocker.password= docker:build

Process fails with:

[ERROR] DOCKER> Configured Dockerfile "/home/ambs/MyReps/exist/exist-docker/target/classes/Dockerfile" (resolved to "/home/ambs/MyReps/exist/exist-docker/target/classes/Dockerfile") doesn't exist

4) still on that folder, try a little more: mvn compile 5) try again mvn -DskipTests -Ddocker.tag=latest -Ddocker.username=admin -Ddocker.password= docker:build

Process fails with:

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.34.1:build (default-cli) on project exist-docker: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.34.1:build failed: /home/ambs/MyReps/exist/exist-docker/target/exist-docker-5.3.0-SNAPSHOT-docker-dir isn't a directory. -> [Help 1]

6) Keep feeding the monster: mkdir target/exist-docker-5.3.0-SNAPSHOT-docker-dir 7) try again mvn -DskipTests -Ddocker.tag=latest -Ddocker.username=admin -Ddocker.password= docker:build

Process fails with:

[ERROR] DOCKER> Unable to build image [existdb/existdb:5.3.0-SNAPSHOT] : "COPY failed: file not found in build context or excluded by .dockerignore: stat LICENSE: file does not exist"  ["COPY failed: file not found in build context or excluded by .dockerignore: stat LICENSE: file does not exist" ]

And no idea how to keep going. I also tried to do a mvn compile and mvn package at the top level, but nothing changed.

Context:

ambs commented 3 years ago

This documents another, different, atempt

1) clone repo 2) enter exist-docker 3) run mvn -X -DskipTests -Ddocker.tag=latest -Ddocker.username=admin -Ddocker.password= clean package docker:build

Got [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.3.0:single (assemble-archives) on project exist-docker: Failed to create assembly: The archive base directory '/home/ambs/MyReps/exist/exist-docker/../exist-distribution/target/exist-distribution-5.3.0-SNAPSHOT-dir' does not exist -> [Help 1]

tried to create the folder manually: 4) mkdir -p ../exist-distribution/target/exist-distribution-5.3.0-SNAPSHOT-dir 5) same command: mvn -X -DskipTests -Ddocker.tag=latest -Ddocker.username=admin -Ddocker.password= clean package docker:build

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.3.0:single (assemble-archives) on project exist-docker: Failed to create assembly: Error creating assembly archive docker-dir: archive cannot be empty -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.3.0:single (assemble-archives) on project exist-docker: Failed to create assembly: Error creating assembly archive docker-dir: archive cannot be empty

Still going nowhere.

adamretter commented 3 years ago

@ambs You don't need to enter the exist-docker folder. You can just do the following:

git clone https://github.com/exist-db/exist.git
cd exist
mvn -V -T2C clean package -DskipTests -Ddependency-check.skip=true
ambs commented 3 years ago

After that command, where is the image? docker image ls doesn't show any tagged image... Thanks

adamretter commented 3 years ago

@ambs It should be shown in docker image ls. If it is not, you will need to share the Maven output from the exist-docker module of the build. To do so cleanly, you should run without the -T2C argument

ambs commented 3 years ago

Attaching the full log. No occurrence of 'docker'... Surely I am doing something wrong.?

exist-build.log

adamretter commented 3 years ago

@ambs Ah ha! Of course, you are right, I forgot one key thing that you need: -Ddocker=true. So can you try:

mvn -V -T2C clean package -DskipTests -Ddependency-check.skip=true -Ddocker=true
ambs commented 3 years ago

HI

existdb/existdb           5.3.0-SNAPSHOT   f185c3d03903   15 seconds ago   324MB

So, it is a "yay". Thanks. I will propose some additions to the README file and send a pull request.

ambs commented 3 years ago

I see here is a list of options: http://www.exist-db.org/exist/apps/doc/exist-building.xml Still, can I add this line as an example in BUILD.md? Users are lazy...

ambs commented 3 years ago

We can close this Meanwhile, PR was added: https://github.com/eXist-db/exist/pull/3710