Skip to content

A Gradle plugin for executing builds agains multiple Dockers, mostly to support the creation of Manifest Lists for multiple architectures.

License

Notifications You must be signed in to change notification settings

jonpspri/gradle-multidocker-plugin

Repository files navigation

Gradle Fat Manifest Plugin

Gradle plugin for working with the Docker Registry, targetted specifically toward creating multi-archtecture image manifests.

Warning
The current implementation is incomplete — the plugin so far supports retrieving simple manifests and metadata from the registry and creating and uploading a multi-architecture manifest. The target registry MUST support the Docker V2 API. The source images, source manifests, and target manifest MUST all be in the same library on that server.

Usage

To use this plugin, include it in your build script.

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.xanophis:gradle-multidocker-plugin:X.Y.Z'
    }
}

And then apply the plugin to projects where you want to use it.

apply plugin: 'com.s390x.gradle.multidocker'

You may need to import task classes:

import com.s390x.gradle.multidocker.tasks.*

Configuring the registry

The plugin depends on the configuration of a target registry:

registry {
    name = gradle.ext.registryCredentials.name
    url = gradle.ext.registryCredentials.url
    username = gradle.ext.registryCredentials.username
    password = gradle.ext.registryCredentials.password
}

The registry name and url will default to the docker registry if not provided, but the username and password are manditory. Users are advised not to hardcode username and password into the build file, but rather to source them from some file that is not included in source code management.

Note
Registry name is an FQDN, e.g. registry.docker.io. The url, on the other hand, is used as the root of REST calls and so will usually be "https:\\${name}\v2\". Defaulting is not yet build into the plugin.

Quick Example

Get two already existing images with two different architectures and create a build for them.

def archs = ['amd64','s390x']

def getManifestTasks = archs.collect() { arch ->
    project.task(name: "getManifest-#{arch}", type: GetManifest) {
        os = 'linux'
        architecture = project.name
        imageName = "${library}/${dockerImageName}"
        tag = "latest-${arch}"
    }
}

task putMultidocker(type: PutMultidocker, dependsOn: tasks) {
    metadataFiles = getManifestTasks*.getMetadataFile()
    imageName = "${library}/${dockerImageName}"
    tag = "latest"
}

About

A Gradle plugin for executing builds agains multiple Dockers, mostly to support the creation of Manifest Lists for multiple architectures.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages