Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does docker:publishLocal support multiple modules? #941

Closed
dluc opened this issue Feb 9, 2017 · 6 comments
Closed

Does docker:publishLocal support multiple modules? #941

dluc opened this issue Feb 9, 2017 · 6 comments
Labels

Comments

@dluc
Copy link

dluc commented Feb 9, 2017

In a project with multiple modules, e.g.
...
/build.sbt
/somelibrary/main/src
/service1/main/src
/service2/main/src
/service3/main/src
...

is it possible to package each service independently, e.g. in this case to 3 different docker images? If so what is the command (from command prompt)?

I'd typically run sbt docker:publishLocal but I think the command is different in this case?

Thanks

@muuki88 muuki88 added the docker label Jun 10, 2017
@muuki88
Copy link
Contributor

muuki88 commented Jun 10, 2017

Sorry for replying this late 😢 . I must have missed this issue.

When you package your projects in sub-modules ( what your example looks like ) then you already get three docker images. E.g. if you have a build.sbt like this

lazy val root = project(".").aggregate(service1, service2, service3)
lazy val service1= project("service1")
    .enablePlugins(JavaAppPackaging)
    .settings(name := "service1")
lazy val service2= project("service2")
    .enablePlugins(JavaAppPackaging)
    .settings(name := "service2")
lazy val service3= project("service3")
    .enablePlugins(JavaAppPackaging)
    .settings(name := "service3")

If you call sbt docker:publishLocal, all three will be published as separate docker images.

@muuki88 muuki88 closed this as completed Jun 10, 2017
@dzlab
Copy link

dzlab commented Nov 9, 2022

@muuki88 is there a way to build an image for one specific sub-project and not all of them at once?

@muuki88
Copy link
Contributor

muuki88 commented Nov 10, 2022

Sure. Either you configure the native packager plugins only on the sub modules you want or you can all the publish/package command scoped to a submodule mySubmodule / Docker / publish

@dzlab
Copy link

dzlab commented Nov 10, 2022

@muuki88 it turns out that DockerPlugin was activated for most sub-projects as a result of activating the JavaAgentPackaging plugin (which is brought by JavaAgent). This caused those sub-projects to have docker related tasks running. We can easily confirm this with a sub-project using .enablePlugins(com.lightbend.sbt.javaagent.JavaAgent).

How do you suggest calling the publish/package command scoped to a submodule mySubmodule / Docker / publish?

@muuki88
Copy link
Contributor

muuki88 commented Nov 11, 2022

What sbt command is triggering the docker related tasks?

Maybe you can try disablePlugins(...) on the sub modules you don't want docker tasks running.

@dzlab
Copy link

dzlab commented Nov 12, 2022

I tried publish and stage, they both seem to have DockerPlugin running. I think I will just override them and use a flag setting to invoke docker tasks if it is set to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants