Simple Gradle plugin to use Docker within your project.
The plugin allows to use following Docker commands by executing a respective Gradle task:
docker build::dockerBuild/:dockerBuildPushdocker push::dockerPushdocker image rm::dockerImageRemove
Only one. docker.
- Add repository to
settings.gradle(.kts):pluginManagement { repositories { maven("https://maven.siverov.com/public") gradlePluginPortal() } } - Apply the plugin:
plugins { id("com.siv.docker") version "1.0.0-SNAPSHOT" } - Define your docker build:
Note: You can specify multiple
docker { image { registry("docker.siverov.com") // default: docker.io/library tag(version.toString()) // default: latest build { dockerfile(file("project.Dockerfile")) // default: Dockerfile arg("JAR_FILE" to tasks.jar.get().outputs.files.first().path.removePrefix(projectDir.absolutePath)) } /* or: build.dockerfile(file("Dockerfile")) build.arg("ARG_NAME", "ARG_VALUE") */ } }image { ... }blocks to build multiple images. - Run a gradle task of your choice (see Features)
- 🎉