##// END OF EJS Templates
Implemented compose
Implemented compose

File last commit:

r4:00ef236c472b v1.1 default
r12:c7d470187afa v1.2.0 default
Show More
readme.md
110 lines | 2.3 KiB | text/x-minidsrc | MarkdownLexer
cin
added description
r1 # Build and publish images with docker/podman
## SYNOPSIS
```gradle
plugins {
cin
Reworked ImageName, added imageName property to the project extension, added TagImage task.
r4 id 'org.implab.gradle-container' version '1.1'
cin
added description
r1 }
container {
// if you want to use podman
cliCmd = "podman"
}
configurations {
app
}
dependencies {
// the application that needs to be built and packed
app project(":server")
}
// add custom task to copy application files
// to the docker build context.
task copyApp(type: Copy) {
processResources.dependsOn it
into container.contextDirectory.dir("root/opt/myapp")
from configurations.app
}
task printVersion {
doLast {
println "tag: ${buildImage.imageTag.get()}"
println "archive: ${saveImage.archiveFileName.get()}"
}
}
```
## Description
This plugin is a simple wrapper around docker CLI. All the image
building process is deligated to the `Dockerfile` which will run
in the prepeared build context.
### Project structure
* `build/`
cin
fixed list indention
r2 * `context/` - the build context where `docker build` command will run.
* `imageid` - the file storing the id of the image has been built.
* `image-name-1.2.3.tgz` - the exported image if `saveImage` has been executed.
cin
added description
r1 * `src`
cin
fixed list indention
r2 * `main` - the source files which will be copied to the build context.
cin
added description
r1
## Properties
`imagesAuthority` - the registry where the image should be published.
for example `docker.io`
`imagesGroup` - the path to the image in the repository.
## Tasks
### buildImage
The task builds the image. Wrapper around the `docker build` command.
### saveImage
The task exports image as the .tar archive.
### pushImage
The task pushes the image to the remote repository.
### processResources
cin
fixed list indention
r2 The copy task, it prepares the build context. Use it to customize
the build context.
cin
Reworked ImageName, added imageName property to the project extension, added TagImage task.
r4
### tagImage
since: 1.1
```gradle
task tagLatest(type: TagImage) {
srcImage = container.imageName
destImage = container.imageName.map { it.tag("latest") }
}
```
## Changes
### 1.1
Warning! This version isn't fully backward compatible with 1.0 version.
* Added `TagImage` task type
* `ImageTag` class is replaced with `ImageName` class
* `BuildImage`, `PushImage` tasks are now accepting only `imageName` property
* Added `imageName`, `imageShortName`, `imageTag` properties to `container` extension
### 1.0
Initial release. Default tasks to build and publish container images.