build.gradle 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. compile('org.springframework.boot:spring-boot-starter-actuator')
  15. compile("de.codecentric:spring-boot-admin-starter-server")
  16. compile("de.codecentric:spring-boot-admin-starter-client")
  17. compile('org.jolokia:jolokia-core')
  18. compile('io.projectreactor.addons:reactor-extra')
  19. }
  20. //复制jar到指定的文件夹中
  21. task copyJar() {
  22. print('copy jar ')
  23. copy {
  24. from("build/libs/zen-web-${version}.jar")
  25. into('../envir-jar/')
  26. }
  27. }
  28. bootJar { enabled = true }
  29. jar { enabled = false }
  30. docker{
  31. baseImage 'openjdk:8-jre-alpine'
  32. maintainer 'tina 976056042@qq.com'
  33. registry 'registry.cn-qingdao.aliyuncs.com'
  34. }
  35. task dockerBuilder(type: Docker) {
  36. registry='registry.cn-qingdao.aliyuncs.com/gxzc-envir'
  37. applicationName = 'registry'
  38. tagVersion = jar.version
  39. addFile("./${jar.baseName}-${jar.version}.jar","app.jar")
  40. entryPoint(["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=GMT+08","-jar",'app.jar'])
  41. exposePort(11010)
  42. doFirst {
  43. copy {
  44. from jar
  45. into stageDir
  46. }
  47. }
  48. push = true
  49. }
  50. dockerBuilder.dependsOn(bootJar)