Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement