Skip to content

Commit

Permalink
Deployment configs
Browse files Browse the repository at this point in the history
### What's done:
* Use docker-compose instead of swarm for now
  • Loading branch information
petertrr committed Feb 17, 2021
1 parent 573498d commit 8b55d5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import org.springframework.boot.gradle.tasks.bundling.BootBuildImage

fun Project.createStackDeployTask() {
tasks.register<Exec>("startLocalDockerRegistry") {
description = "Start local docker registry for spring boot images"
enabled = false
description = "Start local docker registry for spring boot images. Disabled, see comment in deployDockerStack task."
commandLine("docker", "service", "create", "--name", "registry", "--publish", "published=6000,target=5000", "registry:2")
}

Expand All @@ -21,15 +22,13 @@ fun Project.createStackDeployTask() {
into("${System.getProperty("user.home")}/configs")
}
}
description = "Deploy docker stack to docker swarm"
description = "Deploy to docker swarm. If swarm contains more than one node, some registry for built images is requried."
commandLine("docker", "stack", "deploy", "--compose-file", "docker-compose.yaml", "save")
// or just run services locally
// commandLine("docker-compose", "up", "-d")
doLast {
exec {
description = "Stop local docker registry"
commandLine("docker", "service", "rm", "registry")
}
}
// doLast {
// exec {
// description = "Stop local docker registry"
// commandLine("docker", "service", "rm", "registry")
// }
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ fun Project.configureSpringBoot() {
tasks.named<BootBuildImage>("bootBuildImage") {
dependsOn(rootProject.tasks.getByName("startLocalDockerRegistry"))
// `host.docker.internal` for win 10?
imageName = "localhost:6000/${project.name}:${project.version}"
imageName = "127.0.0.1:6000/${project.name}:${project.version}"
environment = mapOf("BP_JVM_VERSION" to Versions.BP_JVM_VERSION)
// setting `isPublish` with temporary local registry seems tricky
doLast {
exec {
commandLine("docker", "push", imageName)
Expand Down

0 comments on commit 8b55d5a

Please sign in to comment.