Skip to content

Commit

Permalink
Remove docker plugin dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
rieske committed Jan 6, 2023
1 parent d70cba4 commit 8843ff5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ just pick a library for a server, a library for JDBC or whatever, a library for
Far too often I have seen services with high unit test coverage percentage fail to even start up when assembled for deployment.

Configures a reproducible build that packages the Java application (using Gradle's core `application` plugin)
in a tar file and configures the [`docker`](https://github.com/bmuschko/gradle-docker-plugin) plugin for further
in a tar file and configures a `docker` task for further
packaging of the built artifact into a docker image.
The resulting docker image will be tagged with `${rootProject.name}:snapshot` and you can then
retag it after the build and push it to some docker registry for deployment.
Expand Down
6 changes: 1 addition & 5 deletions plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ plugins {
}

group = "io.github.rieske.java-service-gradle-plugins"
version = "1.0.0"
version = "1.1.0"

tasks.named("test") {
useJUnitPlatform()
}

dependencies {
// TODO: 9.1.0 seems to hang on Java 11
//implementation("com.bmuschko:gradle-docker-plugin:9.1.0")
implementation("com.bmuschko:gradle-docker-plugin:9.0.1")

testImplementation(platform("org.spockframework:spock-bom:2.3-groovy-3.0"))
testImplementation("org.spockframework:spock-core")
}
Expand Down
9 changes: 5 additions & 4 deletions plugins/src/main/groovy/io.github.rieske.java-service.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("application")
id("com.bmuschko.docker-remote-api")
}

def dockerfile = layout.projectDirectory.file("Dockerfile")
Expand All @@ -12,10 +11,12 @@ def prepareDockerContextTask = tasks.register("prepareDockerContext", Copy) {
from(dockerfile)
}

def dockerTask = tasks.register("docker", com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
def dockerTask = tasks.register("docker", Exec) {
dependsOn(prepareDockerContextTask)
inputDir.set(dockerContextDir)
images.add("${rootProject.name}:snapshot".toString())
inputs.files(dockerfile, applicationTarArchive).withPathSensitivity(PathSensitivity.RELATIVE)
workingDir = dockerContextDir
commandLine = ["docker", "build", "-t", "${rootProject.name}:snapshot", "."]
outputs.dir(dockerContextDir)
}

testing.suites {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class JavaServicePluginTest extends PluginTest {

then:
result.task(":docker").outcome == TaskOutcome.FAILED
result.output.contains("> Dockerfile does not exist")
result.output.contains("build/docker/Dockerfile: no such file or directory")
result.task(":blackBoxTest") == null
}

Expand Down

0 comments on commit 8843ff5

Please sign in to comment.