Created
May 26, 2016 10:39
-
-
Save khauser/258b722c82648554ab89c75435f35121 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
apply plugin: 'application' | |
apply plugin: 'docker' | |
import org.apache.tools.ant.taskdefs.condition.Os | |
def DOCKER_REPO = "klhauser" | |
task buildDockerImage(type: Docker) { | |
tagVersion = 'latest' | |
tag = DOCKER_REPO + "/lessoria-" + jar.baseName | |
push = project.hasProperty('push') | |
addFile { | |
from jar | |
rename {'app.jar'} | |
} | |
entryPoint(['java', '-Djava.security.egd=file:/dev/./urandom', '-Dspring.profiles.active=docker', '-jar', '/app.jar']) | |
} | |
task upDockerCompose (type: Exec) { | |
//dependsOn buildDockerImage | |
if (Os.isFamily(Os.FAMILY_WINDOWS)) { | |
commandLine "cmd", "/c", "docker-compose", "up", "-d" | |
} | |
else { | |
commandLine "docker-compose", "up", "-d" | |
} | |
} | |
upDockerCompose.doLast { | |
sleep(30 * 1000) | |
} | |
task downDockerCompose (type: Exec) { | |
//dependsOn buildDockerImage | |
if (Os.isFamily(Os.FAMILY_WINDOWS)) { | |
commandLine "cmd", "/c", "docker-compose", "down" | |
} | |
else { | |
commandLine "docker-compose", "down" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment