Last active
November 28, 2017 19:36
-
-
Save danhyun/cfa1635a971820644ac8b38edc875faa to your computer and use it in GitHub Desktop.
gradle + docker + blockdiag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.bmuschko:gradle-docker-plugin:3.2.1' | |
} | |
} | |
// use fully qualified class name | |
apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin | |
// import task classes | |
import com.bmuschko.gradle.docker.tasks.container.* | |
import com.bmuschko.gradle.docker.tasks.image.* | |
repositories { | |
mavenCentral() | |
} | |
task pullBlockDiagImage(type: DockerPullImage) { | |
repository = 'manabu/blockdiag-docker' | |
tag = "0.2.0" | |
} | |
task createBlockDiagContainer(type: DockerCreateContainer) { | |
dependsOn pullBlockDiagImage | |
targetImageId { "manabu/blockdiag-docker:0.2.0" } | |
binds = [(projectDir.toString()) : '/work'] | |
cmd = ["/bin/sh", "-c", "blockdiag *.diag"] | |
} | |
task startBlockDiagContainer(type: DockerStartContainer) { | |
dependsOn createBlockDiagContainer | |
targetContainerId { createBlockDiagContainer.containerId } | |
} | |
task removeBlockDiagContainer(type: DockerRemoveContainer) { | |
targetContainerId { createBlockDiagContainer.containerId } | |
} | |
task generateBlockDiag(type: DockerWaitContainer) { | |
dependsOn startBlockDiagContainer | |
targetContainerId { createBlockDiagContainer.containerId } | |
finalizedBy removeBlockDiagContainer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment