blob: 8980e823a672c17993db2193c6fecb48b9ce1a29 [file] [log] [blame]
plugins {
id "com.github.ben-manes.versions" version "0.12.0"
id "de.gesellix.docker" version "2016-05-05T13-15-11"
}
import de.gesellix.gradle.docker.tasks.*
import static groovy.json.JsonOutput.prettyPrint
import static groovy.json.JsonOutput.toJson
allprojects {
apply plugin: 'base'
apply plugin: 'de.gesellix.docker'
docker {
// dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock'
// dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376'
// certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default"
// authConfigPlain = [
// "username" : "joe",
// "password" : "some-pw-as-needed",
// "email" : "joe@acme.com",
// "serveraddress" : "https://index.docker.io/v1/"
// ]
}
}
task ping(type: DockerPingTask) {
doLast { println prettyPrint(toJson(result.content)) }
}
task info(type: DockerInfoTask) {
doLast { println prettyPrint(toJson(info)) }
}
task version(type: DockerVersionTask) {
doLast { println prettyPrint(toJson(version)) }
}
//task publish(type: DockerPublishTask) {
// imageName = 'nginx'
// imageTag = 'cand'
// buildContextDirectory = file('./docker/')
// targetRegistries = [
// dev: "localhost:5000"
// ]
//}
task fetch(type: DockerPullTask) {
imageName = 'nginx@sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
// tag = 'sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
// tag = '1.10.0'
// authConfigPlain = getDockerClient().readDefaultAuthConfig()
}
task tag(type: DockerTagTask) {
dependsOn fetch
imageId = 'nginx@sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
tag = 'nginx:cand'
}
task publish(type: DockerPushTask) {
dependsOn tag
repositoryName = 'nginx:cand'
registry = 'localhost:5000'
}