Skip to content

Instantly share code, notes, and snippets.

@idoshamun
Created November 3, 2017 07:39
Show Gist options
  • Save idoshamun/370f19c45832281b68b4e3cfc6f8536d to your computer and use it in GitHub Desktop.
Save idoshamun/370f19c45832281b68b4e3cfc6f8536d to your computer and use it in GitHub Desktop.
Dockerizing Scala Application
// No need to run tests while building jar
test in assembly := {}
// Simple and constant jar name
assemblyJarName in assembly := s"app-assembly.jar"
// Merge strategy for assembling conflicts
assemblyMergeStrategy in assembly := {
case PathList("reference.conf") => MergeStrategy.concat
case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
case _ => MergeStrategy.first
}
FROM openjdk:8-jre-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY ./run_jar.sh ./app-assembly.jar ./
ENTRYPOINT ["./run_jar.sh"]
// sbt-assembly for "fat jars"
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
#!/usr/bin/env sh
java $* -jar app-assembly.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment