buildscript { repositories { mavenCentral() } dependencies { classpath('se.transmode.gradle:gradle-docker:1.2') } } apply plugin: 'docker' apply plugin: 'application' dependencies{ compile project(':envir-config') //监控 compile('org.springframework.boot:spring-boot-starter-actuator') compile("de.codecentric:spring-boot-admin-starter-server") compile("de.codecentric:spring-boot-admin-starter-client") compile('org.jolokia:jolokia-core') compile('io.projectreactor.addons:reactor-extra') } bootJar { enabled = true } jar { enabled = false } docker{ baseImage 'openjdk:8-jre-alpine' maintainer 'tina 976056042@qq.com' registry 'registry.cn-hangzhou.aliyuncs.com' } task dockerBuilder(type: Docker) { registry='registry.cn-hangzhou.aliyuncs.com/tuon' applicationName = 'eureka_config' tagVersion = jar.version addFile("./${jar.baseName}-${jar.version}.jar","app.jar") addFile("*.yml","/config/") entryPoint(["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=GMT+08",'${JAVA_OPTS}',"-jar",'app.jar']) exposePort(12121) doFirst { copy { from jar into stageDir } copy { from "${buildDir}/resources/main" include "*.yml" into stageDir } } push = false } dockerBuilder.dependsOn(bootJar)