Google 云生成器 - Gradle

Google Cloud Builder - Gradle

https://cloudplatform.googleblog.com/2017/03/Google-Cloud-Container-Builder-a-fast-and-flexible-way-to-package-your-software.html

post 之后

我了解到 Gradle 支持 Google Container Builder。但是我找不到任何例子。我对在构建中明确设置 gradle 版本特别感兴趣。

我们在 Google Cloud Container Builder 中使用 Gradle 构建 Spinnaker 组件。

我们在 GitHub 存储库中签入了一个 Gradle 包装器,我们在 gradle-wrapper.properties 文件的 distributionUrl 中设置了版本:

#Thu Nov 12 15:41:58 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip

来源:https://github.com/spinnaker/gate/blob/master/gradle/wrapper/gradle-wrapper.properties

然后我们正常调用./gradlew。这是来自同一存储库的 cloudbuild.yaml 示例:

steps:
- name: 'java:8'
  env: ["GRADLE_USER_HOME=cache"]
  entrypoint: "bash"
  args: [ "-c", "./gradlew gate-web:installDist -x test"]
- name: 'gcr.io/cloud-builders/docker'
  args: ["build", "-t", "gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA", "-t", "gcr.io/$PROJECT_ID/$REPO_NAME:latest", "-f", "Dockerfile.slim", "."]
images:
- 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/$REPO_NAME:latest'

来源:https://github.com/spinnaker/gate/blob/master/cloudbuild.yaml