Name: runtime-builder-java
Owner: Google Cloud Platform
Description: A Google Cloud Container Builder pipeline for packaging Java applications into docker containers
Created: 2017-03-15 19:34:10.0
Updated: 2018-02-21 22:48:39.0
Pushed: 2018-01-23 21:12:47.0
Size: 251
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A Google Cloud Container Builder pipeline for packaging Java applications into supported Google Cloud Runtime containers. It consists of a series of docker containers, used as build steps, and a build pipeline configuration file.
To run via Google Cloud Container Builder, first install the Google Cloud SDK. Then, initiate a Cloud Container Build using the provided java.yaml file:
termine the name of your desired output image. Note that it must be a path to a Google Container
gistry bucket to which your Cloud SDK installation has push access.
UT_IMAGE=gcr.io/my-gcp-project/my-application-container
itiate the cloud container build
ud container builds submit /path/to/my/java/app \
--config java.yaml \
--substitutions _OUTPUT_IMAGE=$OUTPUT_IMAGE
After the build completes, the built application container will appear in the gcr.io container registry at the specified path.
Build steps can be run locally, one at a time, using docker. (This requires that the runtime-builder
image is available locally.) Note that these commands effectively mirror the steps in the
java.yaml pipeline config file.
L_APPLICATION_DIR=/path/to/my/app
nerate docker resources
e java.yaml for the fully specified jdk-runtimes-map server-runtimes-map args
er run -v $LOCAL_APPLICATION_DIR:/workspace -w /workspace runtime-builder
ckage my application into a docker container
er build -t my-app-container $LOCAL_APPLICATION_DIR
An app.yaml
file can be included in the sources passed to the Java Runtime Builder, but is not required. The
runtime_config
section of this file tells the builder how to build and package your source.
In most cases, runtime_config
can be omitted.
Alternatively, these settings can be provided as command line arguments to the Java Runtime Builder.
| Option Name | Type | Default | Description |
|———-|——|———|————-|
| jdk | string | openjdk8 | Select the JDK used in the generated image. Must be either openjdk8
or openjdk9
. NOTE: openjdk9
is not compatible with the server
option (see below).
| server | string | jetty | Select the web server to use in the generated image. Must be either jetty9
or tomcat8
| artifact | string | Discovered based on the content of your build output | The path where the builder should expect to find the artifact to package in the resulting docker container. This setting will be required if your build produces more than one artifact.
| build_script | string | mvn -B -DskipTests clean package
if a maven project is detected, or gradle build
if a gradle project is detected | The build command that is executed to build your source |
| jetty_quickstart | boolean | false | Enable the Jetty quickstart module to speed up the start time of the application (Only available if the jetty runtime is selected).
The settings in app.yaml and the command line share the same names. For example, --jdk=openjdk8
can be included in the args:
section of java.yaml. If a setting is provided in both
app.yaml and the command line, the setting from the command line will be used.
ime: java
flex
l parameters specified below in the runtime_config block are optional
ime_config:
tifact: "target/my-artifact.jar"
ild_script: "mvn clean install -Pcloud-build-profile"
tty_quickstart: true
The --jdk-runtimes-map
and --server-runtimes-map
settings are optional in both
java.yaml when using the Cloud Container Builder as well as when building locally.
These are the default mappings and will be available unless individually overridden:
| JDK Runtime Mapping | Default |
|—————–|————-|
|*
| gcr.io/google-appengine/openjdk:8
|
|openjdk8
|gcr.io/google-appengine/openjdk:8
|
|openjdk9
|gcr.io/google-appengine/openjdk:9
|
| Server Runtime Mapping | Default |
|—————–|————-|
|*
|*
|gcr.io/google-appengine/jetty:9
|
|openjdk8
|*
|gcr.io/google-appengine/jetty:9
|
|openjdk8
|jetty9
|gcr.io/google-appengine/jetty:9
|
|openjdk8
|jetty
|gcr.io/google-appengine/jetty:9
|
|openjdk8
|tomcat8
|gcr.io/google-appengine/tomcat:8
|
|openjdk8
|tomcat
|gcr.io/google-appengine/tomcat:8
|
|*
|jetty9
|gcr.io/google-appengine/jetty:9
|
|*
|jetty
|gcr.io/google-appengine/jetty:latest
|
|*
|tomcat8
|gcr.io/google-appengine/tomcat:8
|
|*
|tomcat
|gcr.io/google-appengine/tomcat:latest
|
These settings are also optional:
| Command Line Settings | Default |
|—–|—–|
|--compat-runtime-image
|gcr.io/google-appengine/jetty9-compat:latest
|
|--maven-docker-image
|gcr.io/cloud-builders/mvn:3.5.0-jdk-8
|
|--gradle-docker-image
|gcr.io/cloud-builders/gradle:4.0-jdk-8
|