-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
84 lines (63 loc) · 2.68 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import sbt._
import sbtbuildinfo.{BuildInfoRenderer, ScalaCaseClassRenderer, ScalaCaseObjectRenderer}
name := "sonar"
scalaVersion := "2.12.7"
version := sys.props.getOrElse("appVersion", IO.read(file("version")).trim)
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-Ypartial-unification"
)
resolvers += "Flyway" at "https://flywaydb.org/repo"
resolvers += Resolver.sonatypeRepo("releases")
resolvers += Resolver.sonatypeRepo("public")
libraryDependencies ++= Dependencies.projectDeps
cancelable in Global := true
enablePlugins(BuildInfoPlugin, sbtdocker.DockerPlugin)
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
docker / dockerfile := {
val dockerFilesLocation = baseDirectory.value / "src/main/docker/"
val jarFile: File = (Compile / packageBin / sbt.Keys.`package`).value
val classpath = (Compile / dependencyClasspath).value
val artifactTargetPath = "app.jar"
new Dockerfile {
from("openjdk:8u212-jre-alpine3.9")
label("SERVICE_ID", "-30")
label("HS_SERVICE_MARKER", "HS_SERVICE_MARKER")
label("DEPLOYMENT_TYPE", "APP")
label("RUNTIME_ID", "-30")
label("SERVICE_NAME", "monitoring")
label("maintainer", "[email protected]")
env("KAFKA_HOST", "kafka")
env("KAFKA_PORT", "9092")
env("APP_PORT", "9091")
run("apk", "update")
run("apk", "add", "--no-cache", "freetype>=2.9.1-r3", "krb5-libs>=1.15.5-r1", "libbz2>=1.0.6-r7",
"libcom_err>=1.44.5-r2", "libcrypto1.1>=1.1.1k-r0", "libjpeg-turbo>=1.5.3-r6", "libssl1.1>=1.1.1k-r0",
"libtasn1>=4.14", "libx11>=1.6.12-r0", "musl>=1.1.20-r6", "openjdk8-jre>=8.272.10-r0",
"openjdk8-jre-base>=8.272.10-r0", "openjdk8-jre-lib>=8.272.10-r0", "sqlite-libs>=3.28.0-r3")
// run("apk", "update")
// run("apk", "add", "--no-cache", "libc6-compat", "nss")
workDir("/app/")
copy(dockerFilesLocation, "./", "daemon:daemon")
copy(classpath.files, "./lib/", "daemon:daemon")
copy(jarFile, artifactTargetPath, "daemon:daemon")
run("chmod", "+x", "start.sh")
user("daemon")
cmd("/app/start.sh")
}
}
docker / imageNames := Seq(
ImageName(s"hydrosphere/${name.value}:${version.value}")
)
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, git.gitCurrentBranch, git.gitCurrentTags, git.gitHeadCommit)
buildInfoPackage := "io.hydrosphere.sonar"
buildInfoOptions += BuildInfoOption.ToJson
buildInfoRenderFactory := ScalaCaseClassRenderer.apply
Compile / unmanagedSourceDirectories += sourceManaged.value
excludeDependencies += "org.slf4j" % "slf4j-log4j12"