gradle-plugin-docker

Docker plugin for Gradle

License

License

Categories

Categories

Gradle Build Tools Docker Container Virtualization Tools
GroupId

GroupId

org.xbib.gradle.plugin
ArtifactId

ArtifactId

gradle-plugin-docker
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

gradle-plugin-docker
Docker plugin for Gradle
Project URL

Project URL

https://github.com/jprante/gradle-plugin-docker
Project Organization

Project Organization

xbib
Source Code Management

Source Code Management

https://github.com/jprante/gradle-plugin-docker

Download gradle-plugin-docker

How to add to project

<!-- https://jarcasting.com/artifacts/org.xbib.gradle.plugin/gradle-plugin-docker/ -->
<dependency>
    <groupId>org.xbib.gradle.plugin</groupId>
    <artifactId>gradle-plugin-docker</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.xbib.gradle.plugin/gradle-plugin-docker/
implementation 'org.xbib.gradle.plugin:gradle-plugin-docker:1.0.2'
// https://jarcasting.com/artifacts/org.xbib.gradle.plugin/gradle-plugin-docker/
implementation ("org.xbib.gradle.plugin:gradle-plugin-docker:1.0.2")
'org.xbib.gradle.plugin:gradle-plugin-docker:jar:1.0.2'
<dependency org="org.xbib.gradle.plugin" name="gradle-plugin-docker" rev="1.0.2">
  <artifact name="gradle-plugin-docker" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.xbib.gradle.plugin', module='gradle-plugin-docker', version='1.0.2')
)
libraryDependencies += "org.xbib.gradle.plugin" % "gradle-plugin-docker" % "1.0.2"
[org.xbib.gradle.plugin/gradle-plugin-docker "1.0.2"]

Dependencies

test (2)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.5.4
org.spockframework : spock-core jar 1.2-groovy-2.5

Project Modules

There are no modules declared in this project.

Gradle Plugin for Docker

This repository provides a Gradle plugin for working with Docker.

The plugin contains tasks for building and pushing images based on a simple configuration block that specifies the container name, the Dockerfile, task dependencies, and any additional file resources required for the Docker build; tasks for populating placeholders in a docker-compose template file with image versions resolved from dependencies; and tasks for starting, stopping, and cleaning up a named container based on a specified image

Documentation

Tasks

There are two task types

  • DockerBuildTask : task type for building a docker image

  • DockerPushTask : task type for pushing a docker image

Apply the plugin using standard gradle convention:

plugins {
    id 'org.xbib.gradle.plugin.docker' version '<version>'
}

Extensions

The extension with name docker has the following attributes:

  • enabled if the task is enabled or not, default is true

  • executableName the executable name of the docker binary, default is docker

  • registry the DNS name of the registry, default is empty

  • imageName the docker image name, default is empty

  • tag the docker image tag, default is empty (which means latest in docker terminology)

docker {
   enabled = true
   registry = 'myhost.mydomain'
   imageName = 'myimage'
   tag = 'mytag'
}

Build a Docker image

To build a docker image, run a task with type DockerBuildTask.

Example

plugins {
  id 'distribution'
  id 'org.xbib.gradle.plugin.docker'
}

task buildDockerImage(type: DockerBuildTask, group: 'docker') {
    registry = 'hub.docker.com'
    imageName = 'username/my-app'
    tag =  'mytag'
    dockerfile {
        add(tasks.distTar.outputs.files.singleFile, '/')
    }
}

Push a Docker image

To push an image to a docker image repository, run a task with tyep DockerPushTask

License

This plugin is made available under the Apache 2.0 License.

Versions

Version
1.0.2