11[ ![ experimental] ( http://badges.github.io/stability-badges/dist/experimental.svg )] ( http://github.com/badges/stability-badges )
2- [ ![ Gradle Plugin Portal] ( https://img.shields.io/badge/gradle%20plugin-v0.1.0 -blue.svg )] ( https://plugins.gradle.org/plugin/com.google.cloud.tools.jib )
2+ [ ![ Gradle Plugin Portal] ( https://img.shields.io/badge/gradle%20plugin-v0.1.1 -blue.svg )] ( https://plugins.gradle.org/plugin/com.google.cloud.tools.jib )
33[ ![ Gitter version] ( https://img.shields.io/gitter/room/gitterHQ/gitter.svg )] ( https://gitter.im/google/jib )
44
55# Jib - Containerize your Gradle Java project
@@ -14,7 +14,6 @@ For the Maven plugin, see the [jib-maven-plugin project](../jib-maven-plugin).
1414These features are not currently supported but will be added in later releases.
1515
1616* Support for WAR format
17- * Define credentials in configuration
1817* Export to a Docker context
1918* Run and debug the built container
2019
@@ -28,7 +27,7 @@ In your Gradle Java project, add the plugin to your `build.gradle`:
2827
2928``` groovy
3029plugins {
31- id 'com.google.cloud.tools.jib' version '0.1.0 '
30+ id 'com.google.cloud.tools.jib' version '0.1.1 '
3231}
3332```
3433
@@ -122,13 +121,22 @@ Property | Type | Default | Description
122121--- | --- | --- | ---
123122` image ` | ` String ` | ` gcr.io/distroless/java ` | The image reference for the base image.
124123` credHelper ` | ` String ` | * None* | Suffix for the credential helper that can authenticate pulling the base image (following ` docker-credential- ` ).
124+ ` auth ` | [ 'auth` ](#auth-closure) | *None* | Specify credentials directly (alternative to ` credHelper`).
125125
126126<a name =" to-closure " ></a >` to ` is a closure with the following properties:
127127
128128Property | Type | Default | Description
129129--- | --- | --- | ---
130130` image ` | ` String ` | * Required* | The image reference for the target image.
131131` credHelper ` | ` String ` | * None* | Suffix for the credential helper that can authenticate pulling the base image (following ` docker-credential- ` ).
132+ ` auth ` | [ 'auth` ](#auth-closure) | *None* | Specify credentials directly (alternative to ` credHelper`).
133+
134+ <a name =" auth-closure " ></a >` auth ` is a closure with the following properties:
135+
136+ Property | Type
137+ --- | ---
138+ ` username ` | ` String `
139+ ` password ` | ` String `
132140
133141### Example
134142
@@ -189,7 +197,42 @@ jib {
189197
190198#### Using Specific Credentials
191199
192- * Not yet supported*
200+ You can specify credentials directly in the extension for the ` from ` and/or ` to ` images.
201+
202+ ``` xml
203+ jib {
204+ from {
205+ image = 'aws_account_id.dkr.ecr.region.amazonaws.com/my-base-image'
206+ auth {
207+ username = USERNAME // Defined in 'gradle.properties'.
208+ password = PASSWORD
209+ }
210+ }
211+ to {
212+ image = 'gcr.io/my-gcp-project/my-app'
213+ auth {
214+ username = 'oauth2accesstoken'
215+ password = 'gcloud auth print-access-token'.execute().text.trim()
216+ }
217+ }
218+ }
219+ ```
220+
221+ These credentials can be stored in ` gradle.properties ` , retrieved from a command (like ` gcloud auth print-access-token ` ), or read in from a file.
222+
223+ For example, you can use a key file for authentication (for GCR, see [ Using a JSON key file] ( https://cloud.google.com/container-registry/docs/advanced-authentication#using_a_json_key_file ) ):
224+
225+ ``` xml
226+ jib {
227+ to {
228+ image = 'gcr.io/my-gcp-project/my-app'
229+ auth {
230+ username = '_json_key'
231+ password = file('keyfile.json').text
232+ }
233+ }
234+ }
235+ ```
193236
194237## How Jib Works
195238
0 commit comments