Use the package settings and optionally specify the mainClass in build.sbt file:

importNativePackagerHelper._name:="akka-sample-main-scala"version:="2.4.20"scalaVersion:="2.11.8"libraryDependencies++=Seq("com.typesafe.akka"%%"akka-actor"%"2.4.20")enablePlugins(JavaServerAppPackaging)mainClassinCompile:=Some("sample.hello.Main")mappingsinUniversal++={// optional example illustrating how to copy additional directorydirectory("scripts")++// copy configuration files to config directorycontentOf("src/main/resources").toMap.mapValues("config/"+_)}// add 'config' directory first in the classpath of the start script,// an alternative is to set the config file locations via CLI parameters// when starting the applicationscriptClasspath:=Seq("../config/")++scriptClasspath.valuelicenses:=Seq(("CC0",url("http://creativecommons.org/publicdomain/zero/1.0")))

Note

Use the JavaServerAppPackaging. Don't use the deprecated AkkaAppPackaging (previously named
packageArchetype.akka_application), since it doesn't have the same flexibility and quality
as the JavaServerAppPackaging.

On a Windows machine you can also use the bin\akka-sample-main-scala.bat script.

In a Docker container

You can use both Akka remoting and Akka Cluster inside of Docker containers. But note
that you will need to take special care with the network configuration when using Docker,
described here: Akka behind NAT or in a Docker container