Skip to content

Instantly share code, notes, and snippets.

@barlog-m
Last active December 13, 2017 14:37
Show Gist options
  • Save barlog-m/6909820a897ded4bb8bbd1d9b0fea805 to your computer and use it in GitHub Desktop.
Save barlog-m/6909820a897ded4bb8bbd1d9b0fea805 to your computer and use it in GitHub Desktop.
gradle docker image build task
task docker(dependsOn: tasks.bootJar) {
def tag = 'app'
def workDir = file("$buildDir/docker")
def dockerFile = file('src/main/docker/Dockerfile')
def inputDir = file("$buildDir/libs")
doLast {
copy {
from inputDir
from dockerFile
into workDir
}
exec {
workingDir workDir
commandLine 'docker', 'build', '--pull', '-t', tag, '.'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment