6

One of the use cases I have where I want to re-use an existing task is: Publishing a locally built docker image to a custom registry.

It would be nice if I can just re-use: Docker / publishLocal but with other setting values.

Initially I thought something like this is possible:

Docker / publishMyReg := {
  dockerAlias := dockerAlias.value.withRegistryHost(Option("myregistry.foo.bar"))
  (Docker / publishLocal).value
}

I was surprised to see that there is no way to run a Task with different setting values or to have Task specific settings.

Whats the intended way of introducing such custom tasks?

I was looking at Commmand but it doesnt seem to do the job here. For the use case above I would like to be able to execute the following: sbt my-project/docker:publishMyReg which, as far as I know, is not possible with a Command.

leozilla
  • 1,296
  • 2
  • 19
  • 29
  • 1
    Does anything [here](https://sbt-native-packager.readthedocs.io/en/latest/recipes/package_configuration.html) help? It looks like you have two options: create a custom `scope` or create a duplicate project with custom configuration. – Jarrod Baker Nov 05 '21 at 09:20
  • thanks @JarrodBaker that helps a lot! I actually already use the "sbt-parameters-and-build-environment" option – leozilla Nov 05 '21 at 20:03

0 Answers0