I have just released version 0.3 of my gradle-dockerfile-plugin. This is a Gradle plugin to build and push Docker images using an external Dockerfile. This means there is no need of inline configuration for Docker in the Gradle build file. The plugin is available through Maven Central and the Gradle Plugin Portal.
Installation
To use the plugin add a build script dependency to your Gradle build file:
or via the new plugin mechanism introduced in Gradle 2.1:
The plugin will add the following tasks to your project:
The dockerBuild task
The dockerBuild task will build a new Docker image. The default settings are:
dockerfile: ${projectDir}/Dockerfile.
imageName: project.name
tags: project.version and latest. For more information see Configuration section.
The dockerPush task
The dockerPush task will push the Docker image to a Docker repository. If authentication is required use docker login to add the credential to your $HOME/.docker/config.json file. This is how it looks like when the example project pushed to DockerHub.
Configuration
The following configuration can be added to your Gradle build file:
WRITTEN BY
Sebastian Glahn is a Senior Software Engineer living in Cologne. He writes about Software Development, 3D-Printing, Robots and other stuff. He is also a maintainer of several open source projects.