build.gradle 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //apply plugin: 'jar'
  2. //apply plugin: 'war'
  3. apply plugin: 'docker'
  4. apply plugin: 'application'
  5. buildscript {
  6. repositories {
  7. mavenCentral()
  8. }
  9. dependencies {
  10. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  11. classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
  12. classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
  13. classpath('se.transmode.gradle:gradle-docker:1.2')
  14. }
  15. }
  16. dependencies {
  17. compile project(":zen-api")
  18. compile project(':cloud-bus')
  19. }
  20. docker{
  21. baseImage 'openjdk:8-jdk-alpine'
  22. maintainer 'tina 976056042@qq.com'
  23. registry 'registry.cn-qingdao.aliyuncs.com'
  24. }
  25. task dockerBuilder(type: Docker) {
  26. registry='registry.cn-qingdao.aliyuncs.com/gxzc-envir'
  27. applicationName = 'fw'
  28. tagVersion = jar.version
  29. addFile("./build/libs/${jar.baseName}-${jar.version}.jar","app.jar")
  30. entryPoint(["java","-Djava.security.egd=file:/dev/./urandom","-jar",'app.jar'])
  31. exposePort(11000)
  32. doFirst {
  33. copy {
  34. from jar
  35. into stageDir
  36. }
  37. }
  38. push = true
  39. }
  40. dockerBuilder.dependsOn(bootJar)
  41. bootJar {
  42. enabled = true
  43. }
  44. jar {
  45. enabled = false
  46. }
  47. //实际上这个配置是没有用的,distDocker 打包出来的,启动不了
  48. startScripts{
  49. mainClassName='org.springframework.boot.loader.JarLauncher'
  50. }