Public | Automated Build

Last pushed: 17 days ago
Short Description
Docker image for Scala and Play with different version.
Full Description

Scala and Play framework Docker Image


  1. Dockerhub: ysihaoy/scala-play
  2. Docker image for Scala, Play framework and SBT project with different versions

Supported tags (combinations of Scala, Play and SBT) and Dockerfile links

How to use in your Scala SBT project

  1. Choose a image tag, e.g 2.12.3-2.6.2-sbt-0.13.15 is highly recommended instead of latest version

  2. Sample of your minimal project structure

    │   build.sbt
    │   Dockerfile
    |       plugins.sbt
    │   │   ...
  3. Sample of your Dockerfile should be like:

    FROM ysihaoy/scala-play:2.12.2-2.6.0-sbt-0.13.15
    # caching dependencies
    COPY ["build.sbt", "/tmp/build/"]
    COPY ["project/plugins.sbt", "project/", "/tmp/build/project/"]
    RUN cd /tmp/build && \
     sbt compile && \
     sbt test:compile && \
     rm -rf /tmp/build
    # copy code
    COPY . /root/app/
    WORKDIR /root/app
    RUN sbt compile && sbt test:compile
    EXPOSE 9000
    CMD ["sbt"]

Optimisation of the build time

In order to have fast CI (continuous integration) build process, sample of your project/, project/plugins.sbt and build.sbt should be like:

  1. project/

    sbt.version = 0.13.15
  2. project/plugins.sbt

    // The Play plugin
    addSbtPlugin("" % "sbt-plugin" % "2.6.0")
  3. build.sbt

    scalaVersion := "2.12.2"

Note: Since activator was EOL-ed on May 24, 2017, instead of using the Activator command, make sure you have sbt 0.13.13 (or higher), and use the “sbt new” command, providing the name of the template. Click here to see more.

Happy hacking Scala, Play framework and Docker

Docker Pull Command
Source Repository

Comments (2)
a month ago

The fix is adding: stdin_open: true in your docker compose file according to

a month ago

Thanks for this image,
however I have an issue. Basically sbt starts and my app will not run.

$ docker logs -f containername
[info] Loading project definition from /root/app/project
[info] Set current project to ProjectName (in build file:/root/app/)

If I change CMD ["sbt"] to CMD ["sbt run"] then the app runs and then immediately stops so the docker container exits.

Please let me know if you have any suggestions?