将 JHipster 6.0.1 推送到 Gitlab 存储库

Push JHipster 6.0.1 to Gitlab repository

一切准备好部署后,我意识到 JHipster 不再有 Docker 文件 ,打包完成 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?

后面是 jhipster/generator-jhipster issue 9761,它指出:

as the docker-push is done in another stage, there is a missing - target/classes in the previous stage.
It is needed by jib. It should look like:

maven-package:
  stage: package
  script:
    - ./mvnw verify -Pprod -DskipTests -Dmaven.repo.local=$MAVEN_USER_HOME
  artifacts:
    paths:
      - target/*.jar
      - target/classes
    expire_in: 1 day

可能由 PR (merged) 9762, commit 50cc009 解决,它仅在 master 中,尚未被任何标签引用。

为了连接到自定义存储库,我将 -Djib.to.image 更改为 -Dimage 并且成功了