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

Setting maintainer for Docker images can be optional. #390

Merged
merged 1 commit into from
Oct 27, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ Any help on testing and improving this feature is appreciated so feel free to re

Native packager now provides experimental `Docker` images.
To enable this feature follow [My First Packaged Server Project guide](http://www.scala-sbt.org/sbt-native-packager/GettingStartedServers/MyFirstProject.html) and use one of the provided Docker tasks for generating images.
The only essential extra setting for creating a local image for testing is:

maintainer in Docker := "John Smith <[email protected]>"

To publish the image, ``dockerRepository`` should also be set.
To publish the image, ``dockerRepository`` should be set.

As with the `systemd` support, help with testing and improvements is appreciated.

Expand Down
17 changes: 12 additions & 5 deletions src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ object DockerPlugin extends AutoPlugin {
))

private[this] final def makeDockerContent(dockerBaseImage: String, dockerBaseDirectory: String, maintainer: String, daemonUser: String, execScript: String, exposedPorts: Seq[Int], exposedVolumes: Seq[String]) = {
val headerCommands = Seq(
Cmd("FROM", dockerBaseImage),
Cmd("MAINTAINER", maintainer)
)
val fromCommand = Cmd("FROM", dockerBaseImage)

val maintainerCommand: Option[Cmd] = {
if (maintainer.isEmpty)
None
else
Some(Cmd("MAINTAINER", maintainer))
}

val dockerCommands = Seq(
Cmd("ADD", "files /"),
Expand Down Expand Up @@ -144,7 +148,10 @@ object DockerPlugin extends AutoPlugin {
)
}

Dockerfile(headerCommands ++ volumeCommands ++ exposeCommand ++ dockerCommands: _*).makeContent
val commands =
Seq(fromCommand) ++ maintainerCommand ++ volumeCommands ++ exposeCommand ++ dockerCommands

Dockerfile(commands: _*).makeContent
}

private[this] final def generateDockerConfig(
Expand Down