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

docker packager ignores settings #605

Closed
raam86 opened this issue Jun 17, 2015 · 2 comments
Closed

docker packager ignores settings #605

raam86 opened this issue Jun 17, 2015 · 2 comments

Comments

@raam86
Copy link

raam86 commented Jun 17, 2015

I have the following build.sbt (some settings removed for brevity)

lazy val overrider = project.in( file("modules/override-flow"))
  .dependsOn(consumer,adapters,monitor,flows)
  .aggregate(consumer, adapters,monitor,flows)
  .enablePlugins(JavaAppPackaging)
  .enablePlugins(DockerPlugin)
  .settings(
    NativePackagerKeys.dockerExposedVolumes := Seq("/opt/docker/logs","/opt/docker/config"),
    NativePackagerKeys.dockerExposedPorts := Seq(8080),
    NativePackagerKeys.dockerBaseImage := "java:8-jre"
)


lazy val root = project.in( file(".") )
  .dependsOn(consumer,adapters,monitor,flows)
  .aggregate(consumer, adapters,monitor,flows)
  .enablePlugins(JavaAppPackaging)
  .enablePlugins(DockerPlugin)

dockerExposedVolumes := Seq("/opt/docker/logs","/opt/docker/config")

dockerExposedPorts := Seq(9999)

dockerBaseImage := "java:8-jre"

root project is packaged as expected but overrider project will package with default settings.
No errors and everything finishes "successfully".

Am I missing something?

@muuki88 muuki88 added the docker label Jun 17, 2015
@muuki88
Copy link
Contributor

muuki88 commented Jun 17, 2015

Hm. So

lazy val overrider = project.in( file("modules/override-flow"))
  .dependsOn(consumer,adapters,monitor,flows)
  .aggregate(consumer, adapters,monitor,flows)
  .enablePlugins(JavaAppPackaging)
  .enablePlugins(DockerPlugin)
  .settings(
    // this should apply these settings correctly to 'overrider'
    dockerExposedVolumes := Seq("/opt/docker/logs","/opt/docker/config"),
    dockerExposedPorts := Seq(8080),
    dockerBaseImage := "java:8-jre"
)

When you run sbt override/docker:publishLocal then the correct docker image should be created.
You can check these settings with

sbt
> project overrider
> show dockerExposedVolumes
> show ... // other settings

The other settings you apply directly in your build.sbt. Actually I'm not sure if these
get overridden, when the AutoPlugins get applied on the project.

dockerExposedVolumes := Seq("/opt/docker/logs","/opt/docker/config")
dockerExposedPorts := Seq(9999)
dockerBaseImage := "java:8-jre"

@raam86
Copy link
Author

raam86 commented Jun 17, 2015

Moving the specific settings to the correct project did the trick:

lazy val root = project.in( file(".") )
  .dependsOn(consumer, adapters, monitor, flows)
  .aggregate(consumer, adapters, monitor, flows)
  .enablePlugins(JavaAppPackaging)
  .enablePlugins(DockerPlugin)
  .settings(dockerExposedVolumes := Seq("/opt/docker/logs","/opt/docker/config"),
  dockerExposedPorts := Seq(9999),
  dockerBaseImage := "java:8-jre")

After applying the changes the image is created correctly.

[info] Step 0 : FROM java:8-jre
[info]  ---> ee50ebc4c64f
[info] Step 1 : WORKDIR /opt/docker
[info]  ---> Using cache
[info]  ---> 876d143bee0c
[info] Step 2 : ADD opt /opt
[info]  ---> 3ed723766e4e
[info] Removing intermediate container 95628663ba29
[info] Step 3 : RUN chown -R daemon:daemon .
[info]  ---> Running in 4549971c24af
[info]  ---> b38c46a5d14f
[info] Removing intermediate container 4549971c24af
[info] Step 4 : EXPOSE 8080
[info]  ---> Running in fa0e3a199ad3
[info]  ---> 855b7ae4cea0
[info] Removing intermediate container fa0e3a199ad3
[info] Step 5 : RUN mkdir -p /opt/docker/logs /opt/docker/config
[info]  ---> Running in 33c08a40edaa
[info]  ---> 5d3a092549f7
[info] Removing intermediate container 33c08a40edaa
[info] Step 6 : RUN chown -R daemon:daemon /opt/docker/logs /opt/docker/config
[info]  ---> Running in d8f4b81b19e8
[info]  ---> 34701ab43e44
[info] Removing intermediate container d8f4b81b19e8
[info] Step 7 : VOLUME /opt/docker/logs /opt/docker/config
[info]  ---> Running in f098ed6ee585
[info]  ---> 6167d6bee160
[info] Removing intermediate container f098ed6ee585
[info] Step 8 : USER daemon
[info]  ---> Running in a6dd914e9873
[info]  ---> 6327d3c63d4e
[info] Removing intermediate container a6dd914e9873
[info] Step 9 : ENTRYPOINT bin/com-apester-overrider
[info]  ---> Running in 71a1daab5952
[info]  ---> fad67673857f
[info] Removing intermediate container 71a1daab5952
[info] Step 10 : CMD 
[info]  ---> Running in d29d797f3699
[info]  ---> 060843fe333f
[info] Removing intermediate container d29d797f3699
[info] Successfully built 060843fe333f

Can not recreate former conditions even after cache cleaning.

@muuki88 muuki88 closed this as completed Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants