build.gradle 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. setEnvironment('JAVA_OPTS', '-Xms256m -Xmx512m')
  32. addFile("./${jar.baseName}-${jar.version}.jar","app.jar")
  33. addFile("*.yml","/config/")
  34. addFile('./docker-entrypoint.sh','/usr/local/bin/')
  35. runCommand("chmod +x /usr/local/bin/docker-entrypoint.sh")
  36. runCommand("ln -s /usr/local/bin/docker-entrypoint.sh /entrypoint.sh")
  37. exposePort(12121)
  38. entryPoint(["docker-entrypoint.sh"])
  39. doFirst {
  40. copy {
  41. from jar
  42. into stageDir
  43. }
  44. copy {
  45. from "${buildDir}/resources/main"
  46. include "*.*"
  47. into stageDir
  48. }
  49. }
  50. push = false
  51. }
  52. dockerBuilder.dependsOn(bootJar)