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

Commit 1282205

Browse files
committed
dockerPublishTags setting key is added for extra publish tags support.
See; sbt/sbt-native-packager#979
1 parent bb6b921 commit 1282205

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ Docker container version number may be specified at the SBT command line by sett
191191
The following configuration settings can be modified in projects that enable this plugin:
192192
* `dockerRepository` (set to the value of `DOCKER_REPOSITORY` or the project name) - used to define where the container
193193
will be published
194+
195+
The following configuration settings can be modified in projects that enable this plugin:
196+
* `dockerPublishTags` (empty by default) - allows extra tags to be added to the docker:publish other than
197+
`latest` and `version`.
194198

195199
### SBT Tasks
196200

src/main/scala/net/cakesolutions/CakeDockerPlugin.scala

+15
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ object CakeDockerPlugin extends AutoPlugin {
4242
packageName in Docker := name.value,
4343
maintainer in Docker := "Cake Solutions <[email protected]>",
4444
version in Docker := sys.props.get("tag").getOrElse(version.value),
45+
dockerPublishTags := Seq(),
46+
dockerBuildOptions ++= {
47+
val alias = dockerAlias.value
48+
dockerPublishTags.value
49+
.flatMap(tag => List("-t", alias.copy(tag = Some(tag)).versioned))
50+
},
4551
dockerCommands += {
4652
val dockerArgList =
4753
CakeBuildInfoKeys.generalInfo.value ++
@@ -101,4 +107,13 @@ object CakeDockerPluginKeys {
101107
taskKey[Unit](
102108
"Runs `docker rmi -f <ids>` for the images associated to the scope"
103109
)
110+
111+
/**
112+
* Setting key defining extra tags that will be added to the
113+
* dockerBuildOptions
114+
*/
115+
val dockerPublishTags: SettingKey[Seq[String]] =
116+
settingKey[Seq[String]](
117+
"Extra tags to publish other than version and latest"
118+
)
104119
}

0 commit comments

Comments
 (0)