After having everything ready to deploy, I realized JHipster
doesn't have a Dockerfile anymore and the packaging is done with jib
. The generated gitlab-ci.yml
has a docker-push stage with a command like this:
./mvnw jib:build -Djib.to.image=$IMAGE_TAG -Djib.to.auth.username=gitlab-ci-token -Djib.to.auth.password=$CI_BUILD_TOKEN
but it fails with
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.11:build (default-cli) on project test-project: Obtaining project build output files failed; make sure you have compiled your project before trying to build the image. (Did you accidentally run "mvn clean jib:build" instead of "mvn clean compile jib:build"?): /builds/amatos/test-project/target/classes -> [Help 1]
As that failed, I tried to run the command locally like this:
./mvnw jib:build -Djib.to.image=registry.gitlab.com/amatos/test-project:v6.0.1 -Djib.to.auth.username=amatos -Djib.to.auth.password=password
but instead of trying to connect to Gitlab's registry, it tries to connect to registry.hub.docker.com:
[INFO] Retrieving registry credentials for registry.hub.docker.com...
What I would like to know is: how do I set it to connect to Gitlab instead of Docker Hub?
In order to connect to a custom repository, I changed -Djib.to.image
to -Dimage
and it worked