1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath('se.transmode.gradle:gradle-docker:1.2')
- }
- }
- apply plugin: 'docker'
- apply plugin: 'application'
- //复制jar到指定的文件夹中
- task copyJar() {
- print('copy jar ')
- copy {
- from("build/libs/zen-web-${version}.jar")
- into('../envir-jar/')
- }
- }
- bootJar { enabled = true }
- jar { enabled = false }
- docker{
- baseImage 'openjdk:8-jre-alpine'
- maintainer 'tina 976056042@qq.com'
- registry 'registry.cn-qingdao.aliyuncs.com'
- }
- task dockerBuilder(type: Docker) {
- registry='registry.cn-qingdao.aliyuncs.com/gxzc-envir'
- applicationName = 'registry'
- tagVersion = jar.version
- addFile("./${jar.baseName}-${jar.version}.jar","app.jar")
- entryPoint(["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=GMT+08","-jar",'app.jar'])
- exposePort(11001)
- doFirst {
- copy {
- from jar
- into stageDir
- }
- }
- push = true
- }
- dockerBuilder.dependsOn(bootJar)
|