一切准备就绪后,我意识到JHipster
不再有Dockerfile并且打包使用jib
. 生成的gitlab-ci.yml
有一个 docker-push 阶段,其命令如下:
./mvnw jib:build -Djib.to.image=$IMAGE_TAG -Djib.to.auth.username=gitlab-ci-token -Djib.to.auth.password=$CI_BUILD_TOKEN
但它失败了
[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]
由于失败了,我尝试像这样在本地运行命令:
./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
但不是尝试连接到 Gitlab 的注册表,而是尝试连接到registry.hub.docker.com:
[INFO] Retrieving registry credentials for registry.hub.docker.com...
我想知道的是:如何将其设置为连接到 Gitlab 而不是 Docker Hub?