Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

NO-TICKET: dockerPublishTags SettingKey #58

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Docker container version number may be specified at the SBT command line by sett
The following configuration settings can be modified in projects that enable this plugin:
* `dockerRepository` (set to the value of `DOCKER_REPOSITORY` or the project name) - used to define where the container
will be published

The following configuration settings can be modified in projects that enable this plugin:
* `dockerPublishTags` (empty by default) - allows extra tags to be added to the docker:publish other than
`latest` and `version`.

### SBT Tasks

Expand Down
15 changes: 15 additions & 0 deletions src/main/scala/net/cakesolutions/CakeDockerPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ object CakeDockerPlugin extends AutoPlugin {
packageName in Docker := name.value,
maintainer in Docker := "Cake Solutions <devops@cakesolutions.net>",
version in Docker := sys.props.get("tag").getOrElse(version.value),
dockerPublishTags := Seq(),
dockerBuildOptions ++= {
val alias = dockerAlias.value
dockerPublishTags.value
.flatMap(tag => List("-t", alias.copy(tag = Some(tag)).versioned))
},
dockerCommands += {
val dockerArgList =
CakeBuildInfoKeys.generalInfo.value ++
Expand Down Expand Up @@ -101,4 +107,13 @@ object CakeDockerPluginKeys {
taskKey[Unit](
"Runs `docker rmi -f <ids>` for the images associated to the scope"
)

/**
* Setting key defining extra tags that will be added to the
* dockerBuildOptions
*/
val dockerPublishTags: SettingKey[Seq[String]] =
settingKey[Seq[String]](
"Extra tags to publish other than version and latest"
)
}