Search code examples
scaladockerplayframeworksbt

build a docker image for Rest API built with Scala Play


I am trying to dockerize the Rest API built with Scala Play so I can use AWS EC2 or Kubernetes to deploy it.

Following this: : https://guilhebl.github.io/scala/backend/docker/play/2017/08/23/scala-play-docker-sbt-native-packager-example/ and it failed using this sequence of command:

sbt playGenerateSecret
sbt dist
sbt docker:publishLocal
docker run -p 9000:9000 -e APPLICATION_SECRET="token from above"  play-scala-rest-api-example:1.0-SNAPSHOT

with this official example app:

https://github.com/playframework/play-samples/tree/2.8.x/play-scala-rest-api-example

Other teams need a Dockerfile to deploy the app to AWS EC2 with Jenkins. Right now it seems like a Dockerfile is not generated until sbt docker:publishLocal

It would be better if we can find some official tutorials showing how to do this.


Solution

  • Answers from mfirry:

     sbt docker:stage 
    

    from https://www.scala-sbt.org/sbt-native-packager/formats/docker.html#tasks