Take a closer look at the new experimental docker feature
for the sbt-native-packager.
You should be able to build a docker container from your play application with a few simple steps.
Adding a maintainer and the exposed ports
import NativePackagerKeys._ // with auto plugins this won't be necessary soon
name := "play-2.3"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws
)
// setting a maintainer which is used for all packaging types
maintainer := "Nepomuk Seiler"
// exposing the play ports
dockerExposedPorts in Docker := Seq(9000, 9443)
and then run
sbt docker:publishLocal
docker run -p 9000:9000 play-2-3:1.0-SNAPSHOT
Update - 1.x version
With sbt-native-packager 1.x ( and so with play 2.4.x ) docker is enabled by default ( because play enables the JavaServerAppPackaging
plugin ).
If you don't have a play application then enable docker with
enablePlugins(JavaAppPackagingPlugin)
maintainer := "Nepomuk Seiler"
// note that the Docker scope is gone!
dockerExposedPorts := Seq(9000, 9443)