blob: 8980e823a672c17993db2193c6fecb48b9ce1a29 [file] [log] [blame]
Zsolt Harasztiec7df102016-05-05 13:34:18 -07001plugins {
2 id "com.github.ben-manes.versions" version "0.12.0"
3 id "de.gesellix.docker" version "2016-05-05T13-15-11"
4}
5
6import de.gesellix.gradle.docker.tasks.*
7
8import static groovy.json.JsonOutput.prettyPrint
9import static groovy.json.JsonOutput.toJson
10
11allprojects {
12 apply plugin: 'base'
13 apply plugin: 'de.gesellix.docker'
14 docker {
15 // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock'
16 // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376'
17 // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default"
18 // authConfigPlain = [
19 // "username" : "joe",
20 // "password" : "some-pw-as-needed",
21 // "email" : "joe@acme.com",
22 // "serveraddress" : "https://index.docker.io/v1/"
23 // ]
24 }
25}
26
27task ping(type: DockerPingTask) {
28 doLast { println prettyPrint(toJson(result.content)) }
29}
30
31task info(type: DockerInfoTask) {
32 doLast { println prettyPrint(toJson(info)) }
33}
34
35task version(type: DockerVersionTask) {
36 doLast { println prettyPrint(toJson(version)) }
37}
38
39//task publish(type: DockerPublishTask) {
40// imageName = 'nginx'
41// imageTag = 'cand'
42// buildContextDirectory = file('./docker/')
43// targetRegistries = [
44// dev: "localhost:5000"
45// ]
46//}
47
48task fetch(type: DockerPullTask) {
49 imageName = 'nginx@sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
50 // tag = 'sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
51 // tag = '1.10.0'
52 // authConfigPlain = getDockerClient().readDefaultAuthConfig()
53}
54
55task tag(type: DockerTagTask) {
56 dependsOn fetch
57 imageId = 'nginx@sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
58 tag = 'nginx:cand'
59}
60
61task publish(type: DockerPushTask) {
62 dependsOn tag
63
64 repositoryName = 'nginx:cand'
65 registry = 'localhost:5000'
66}