-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
54 lines (48 loc) · 1.75 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
46
47
48
49
50
51
52
53
54
name := "highloadcup2017"
version := "1.0"
scalaVersion := "2.12.3"
libraryDependencies ++= Seq(
"com.github.pathikrit" %% "better-files" % "2.17.1",
"io.spray" %% "spray-json" % "1.3.3",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.7.2",
"com.typesafe.akka" %% "akka-actor" % "2.5.4",
"org.rapidoid" % "rapidoid-http-fast" % "5.4.2"
)
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("openjdk:9")
// Add all files on the classpath
add(classpath.files, "/app/")
// Add the JAR file
add(jarFile, jarTarget)
// Expose HTTP server port
expose(80)
// On launch run Java with the classpath and the main class
entryPoint("java",
"-XX:+UseParallelGC",
"-Xmx3488m",
"-Xms3488m",
"-XX:NewSize=1300m",
"-XX:MaxNewSize=1300m",
"-XX:MaxDirectMemorySize=512m",
"-XX:MaxMetaspaceSize=48m",
"-XX:CompressedClassSpaceSize=48m",
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseCGroupMemoryLimitForHeap",
"-Djava.lang.Integer.IntegerCache.high=11000000",
"-Xlog:gc*",
"--add-modules", "java.xml.bind",
"-cp", classpathString, mainclass, "80")
}
}
imageNames in docker := Seq(ImageName("stor.highloadcup.ru/travels/ultra_chinook"))