build.gradle 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. //复制jar到指定的文件夹中
  12. task copyJar() {
  13. print('copy jar ')
  14. copy {
  15. from("build/libs/zen-web-${version}.jar")
  16. into('../envir-jar/')
  17. }
  18. }
  19. bootJar { enabled = true }
  20. jar { enabled = false }
  21. docker{
  22. baseImage 'openjdk:8-jre-alpine'
  23. maintainer 'tina 976056042@qq.com'
  24. registry 'registry.cn-qingdao.aliyuncs.com'
  25. }
  26. task dockerBuilder(type: Docker) {
  27. registry='registry.cn-qingdao.aliyuncs.com/gxzc-envir'
  28. applicationName = 'registry'
  29. tagVersion = jar.version
  30. addFile("./${jar.baseName}-${jar.version}.jar","app.jar")
  31. entryPoint(["java","-XX:+UnlockExperimentalVMOptions","-XX:+UseCGroupMemoryLimitForHeap","-Djava.security.egd=file:/dev/./urandom","-Duser.timezone=GMT+08","-jar",'app.jar'])
  32. exposePort(11001)
  33. doFirst {
  34. copy {
  35. from jar
  36. into stageDir
  37. }
  38. }
  39. push = true
  40. }
  41. dockerBuilder.dependsOn(bootJar)