docker.gradle 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. buildscript {
  2. ext {
  3. springBootVersion = '1.4.4.RELEASE'
  4. }
  5. repositories {
  6. maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
  7. mavenCentral()
  8. jcenter()
  9. }
  10. dependencies {
  11. classpath('se.transmode.gradle:gradle-docker:1.2')
  12. }
  13. }
  14. //apply plugin: 'docker'
  15. apply plugin: se.transmode.gradle.plugins.docker.DockerPlugin
  16. // 这里产生的镜像的标签会和 project。group一样,暂未找到解决办法
  17. // tag = "${project.group}/${applicationName}:${tagVersion}"
  18. task buildDocker(type:Docker, dependsOn: build) {
  19. push = true
  20. // applicationName = jar.baseName
  21. tag = "10.10.100.200:5000/${jar.baseName}"
  22. dockerfile = file('src/main/docker/Dockerfile')
  23. doFirst {
  24. copy {
  25. from jar
  26. into stageDir
  27. }
  28. }
  29. }
  30. docker {
  31. hostUrl 'https://192.168.99.100:2376' // set the URL used to contact the Docker server. Defaults to http://localhost:2375
  32. dockerBinary 'C:\\Program Files\\Docker Toolbox\\docker.exe'
  33. useApi false // Use the Docker Remote API instead of a locally installed docker binary.
  34. maintainer 'yangck'// The name and email address of the image maintainer.
  35. registry '10.10.100.200:5000' // The hostname and port of the Docker image registry unless the Docker Hub Registry is used.
  36. }