本文介绍了Google Cloud Builder-Gradle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我了解Google容器生成器支持Gradle.但是我找不到任何例子.我对在构建中显式设置gradle版本特别感兴趣.

I understand that Gradle is supported for Google Container Builder. Yet I am not able to find any examples. I am specifically interested in setting the gradle version explicitly in the build.

推荐答案

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

We build Spinnaker components using Gradle within Google Cloud Container Builder.

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

We have a Gradle wrapper checked into our GitHub repo, and we set the version within the distributionUrl of the gradle-wrapper.properties file:

#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示例:

We then call ./gradlew normally. Here's a cloudbuild.yaml example from the same repo:

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

这篇关于Google Cloud Builder-Gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 17:15