Skip to content

Instantly share code, notes, and snippets.

@TomLous
Created January 1, 2020 09:59
Show Gist options
  • Save TomLous/5172684dd61a18696689ba9735e46a23 to your computer and use it in GitHub Desktop.
Save TomLous/5172684dd61a18696689ba9735e46a23 to your computer and use it in GitHub Desktop.
build.sbt part 3 for Medium Post
val targetDockerJarPath = "/opt/spark/jars"
// For building the docker image
lazy val dockerSettings = Seq(
imageNames in docker := Seq(
ImageName(s"$domain/${name.value}:latest"),
ImageName(s"$domain/${name.value}:${version.value}"),
),
buildOptions in docker := BuildOptions(
cache = false,
removeIntermediateContainers = BuildOptions.Remove.Always,
pullBaseImage = BuildOptions.Pull.Always
),
dockerfile in docker := {
// The assembly task generates a fat JAR file
val artifact: File = assembly.value
val artifactTargetPath = s"$targetDockerJarPath/$domain-${name.value}.jar"
new Dockerfile {
from(s"localhost:5000/spark-runner")
}.add(artifact, artifactTargetPath)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment