build.gradle 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. }
  5. dependencies {
  6. classpath('se.transmode.gradle:gradle-docker:1.2')
  7. }
  8. }
  9. apply plugin: 'docker'
  10. apply plugin: 'application'
  11. dependencies{
  12. compile project(':envir-config')
  13. }
  14. //复制jar到指定的文件夹中
  15. task copyJar() {
  16. print('copy jar ')
  17. copy {
  18. from("build/libs/zen-web-${version}.jar")
  19. into('../envir-jar/')
  20. }
  21. }
  22. bootJar { enabled = true }
  23. jar { enabled = false }
  24. docker{
  25. baseImage 'openjdk:8-jre-alpine'
  26. maintainer 'tina 976056042@qq.com'
  27. registry 'registry.cn-qingdao.aliyuncs.com'
  28. }
  29. task dockerBuilder(type: Docker) {
  30. registry='registry.cn-qingdao.aliyuncs.com/gxzc-envir'
  31. applicationName = 'registry'
  32. tagVersion = jar.version
  33. addFile("./${jar.baseName}-${jar.version}.jar","app.jar")
  34. entryPoint(["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=GMT+08","-jar",'app.jar'])
  35. exposePort(11001)
  36. doFirst {
  37. copy {
  38. from jar
  39. into stageDir
  40. }
  41. }
  42. push = true
  43. }
  44. dockerBuilder.dependsOn(bootJar)