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

Cannot pack templates/etc-default into Docker container #398

Closed
alaz opened this issue Nov 2, 2014 · 3 comments
Closed

Cannot pack templates/etc-default into Docker container #398

alaz opened this issue Nov 2, 2014 · 3 comments
Labels
docker documentation Documentation should be extended or updated

Comments

@alaz
Copy link

alaz commented Nov 2, 2014

I am trying to build a Docker container w/ the application default arguments in /etc/default/<name>. I've started with the simplest possible example sbt-native-packager-examples / docker. As far as I understand not all of the documentation is up-to-date to the current 1.0.0-M1 release, so I had to dig a bit myself. Unfortunately I still cannot manage to create etc/default/.. automatically.

I have a master branch of https://github.com/muuki88/sbt-native-packager-examples w/ the following changes:

diff --git a/docker/build.sbt b/docker/build.sbt
index 3a54c10..e9f00e9 100644
--- a/docker/build.sbt
+++ b/docker/build.sbt
@@ -1,5 +1,3 @@
-import NativePackagerKeys._
-
 name := "mukis-docking-station"

 version := "1.0"
@@ -10,13 +8,10 @@ libraryDependencies ++= Seq(

 mainClass in Compile := Some("de.mukis.ConfigApp")

-packageArchetype.java_server
+enablePlugins(JavaServerAppPackaging, DockerPlugin)

 maintainer in Docker := "Nepomuk Seiler <nepomuk.seiler@mukis.de>"

 packageSummary in Docker := "A small docker application"

 packageDescription := "Docker [micro|nano] Service"
-
-// Only add this if you want to rename your docker image name
-packageName in Docker := "docking-station"
diff --git a/docker/project/build.properties b/docker/project/build.properties
index be6c454..64abd37 100644
--- a/docker/project/build.properties
+++ b/docker/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.5
+sbt.version=0.13.6
diff --git a/docker/project/plugins.sbt b/docker/project/plugins.sbt
index bfe0a10..fb07d6a 100644
--- a/docker/project/plugins.sbt
+++ b/docker/project/plugins.sbt
@@ -1,4 +1,4 @@
 // The Typesafe repository 
 resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

-addSbtPlugin("com.typesafe.sbt" %% "sbt-native-packager" % "0.8.0-M1")
+addSbtPlugin("com.typesafe.sbt" %% "sbt-native-packager" % "1.0.0-M1")

Running sbt clean docker:stage in docker folder results in:

$ LANG=C ls -lR target/docker
total 8
-rw-r--r--+ 1 alaz  staff  207 Nov  2 13:07 Dockerfile
drwxr-xr-x+ 3 alaz  staff  102 Nov  2 13:07 files

target/docker/files:
total 0
drwxr-xr-x+ 3 alaz  staff  102 Nov  2 13:07 opt

target/docker/files/opt:
total 0
drwxr-xr-x+ 4 alaz  staff  136 Nov  2 13:07 docker

target/docker/files/opt/docker:
total 0
drwxr-xr-x+ 4 alaz  staff  136 Nov  2 13:07 bin
drwxr-xr-x+ 5 alaz  staff  170 Nov  2 13:07 lib

target/docker/files/opt/docker/bin:
total 40
-rwxr--r--+ 1 alaz  staff  10489 Nov  2 13:07 mukis-docking-station
-rw-r--r--+ 1 alaz  staff   4946 Nov  2 13:07 mukis-docking-station.bat

target/docker/files/opt/docker/lib:
total 14368
-rw-r--r--+ 1 alaz  staff   217897 Jan 15  2014 com.typesafe.config-1.2.0.jar
-rw-r--r--+ 1 alaz  staff     5061 Nov  2 13:07 mukis-docking-station.mukis-docking-station-1.0.jar
-rw-r--r--+ 1 alaz  staff  7126372 Mar 18  2014 org.scala-lang.scala-library-2.10.4.jar
@muuki88 muuki88 added docker bug documentation Documentation should be extended or updated and removed bug labels Nov 2, 2014
@muuki88
Copy link
Contributor

muuki88 commented Nov 3, 2014

I think the etc-default file is not the right way if you create a docker container.
Instead you want to change these settings

bashScriptConfigLocation := Some("/opt/docker/" + packageName.value + "/conf/etc-default")

Then put a etc-default in src/universal/conf/ and your application will pick it up correctly.

However this won't work yet. I just submitted a fix for this.

@alaz
Copy link
Author

alaz commented Nov 4, 2014

Thanks!

I have also

defaultLinuxInstallLocation in Docker := "/app"

b/c I prefer /app location for applications in a Docker container. Is it idiomatic? (sorry for asking in this issue)

@muuki88
Copy link
Contributor

muuki88 commented Nov 4, 2014

Im not sure about idiomatic docker, but /opt/ is one of the unix standard app directories.

muuki88 added a commit that referenced this issue Nov 7, 2014
Not hardcoding bashscript config location #398
@muuki88 muuki88 closed this as completed Nov 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker documentation Documentation should be extended or updated
Projects
None yet
Development

No branches or pull requests

2 participants