在一切准备就绪之后,我意识到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?
-Djib.to.image
更改为-Dimage
来解决的,然后它连接到了GitLab的注册表。 - Alejandro