Search code examples
dockerplayframework-2.0sbt-native-packager

How to pass -mem to dockerized Play application


I'm using Play! 2.5. When I run my application, I run it with -mem 4000. How can I send this option to the Docker image that I create with activator docker:publish? I've looked at the commands specified by activator show dockerCommands, and I see the ENTRYPOINT is bin/myappname - can I edit it to add -mem 4000 there? Or do I need to use -Xmx and -Xms? Do I put these options somewhere else? I have seen some references to an application.ini file, but I"m not sure where to put that in a Play! app.


Solution

  • I poked further around the sbt-native-packager documentation, and under Recipes, found a section on Play. The less confusing (to me, anyway) way to accomplish this was to add:

        javaOptions in Universal ++= Seq(
          // JVM memory tuning
         "-J-Xmx4000m",
         "-J-Xms512m"
        )