-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
45 lines (40 loc) · 1.46 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name := "telegram-connector"
version := "1.0"
scalaVersion := "2.12.1"
libraryDependencies ++= Seq(
"info.mukel" %% "telegrambot4s" % "3.0.14",
"org.apache.kafka" % "kafka-clients" % "0.11.0.0",
"io.spray" %% "spray-json" % "1.3.3",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe" % "config" % "1.3.1",
"org.scalaz" %% "scalaz-core" % "7.2.14",
"com.jsuereth" %% "scala-arm" % "2.0",
"org.scalatest" %% "scalatest" % "3.0.1" % Test,
"org.scalamock" %% "scalamock-scalatest-support" % "3.6.0" % Test,
"com.typesafe.akka" %% "akka-testkit" % "2.5.3" % Test,
"net.manub" %% "scalatest-embedded-kafka" % "0.16.0" % Test
)
enablePlugins(DockerPlugin)
dockerfile in docker := {
val jarFile: File = sbt.Keys.`package`.in(Compile, packageBin).value
val classpath = (managedClasspath in Compile).value
val mainclass = mainClass.in(Compile, packageBin).value.getOrElse(
sys.error("Expected exactly one main class"))
val jarTarget = s"/app/${jarFile.getName}"
// Make a colon separated classpath with the JAR file
val classpathString = classpath.files.map("/app/" + _.getName).mkString(":") + ":" + jarTarget
new Dockerfile {
// Base image
from("java")
// Add all files on the classpath
add(classpath.files, "/app/")
// Add the JAR file
add(jarFile, jarTarget)
// On launch run Java with the classpath and the main class
entryPoint("java",
"-cp", classpathString,
"-Xmx128m",
mainclass
)
}
}