build.gradle 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. bootJar { enabled = true }
  21. jar { enabled = false }
  22. docker{
  23. baseImage 'openjdk:8-jre-alpine'
  24. maintainer 'tina 976056042@qq.com'
  25. registry 'registry.cn-hangzhou.aliyuncs.com'
  26. }
  27. task dockerBuilder(type: Docker) {
  28. registry='registry.cn-hangzhou.aliyuncs.com/tuon'
  29. applicationName = 'eureka_config'
  30. tagVersion = jar.version
  31. addFile("./${jar.baseName}-${jar.version}.jar","app.jar")
  32. addFile("*.yml","/config/")
  33. entryPoint(["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=GMT+08",'${JAVA_OPTS}',"-jar",'app.jar'])
  34. exposePort(12121)
  35. doFirst {
  36. copy {
  37. from jar
  38. into stageDir
  39. }
  40. copy {
  41. from "${buildDir}/resources/main"
  42. include "*.yml"
  43. into stageDir
  44. }
  45. }
  46. push = false
  47. }
  48. dockerBuilder.dependsOn(bootJar)