This repository was archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
executable file
·50 lines (42 loc) · 1.54 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
import java.text.SimpleDateFormat
import java.util.Date
name := "jvm-bloggers-twitter-client"
version := "1.0"
scalaVersion := "2.11.8"
enablePlugins(DockerPlugin)
libraryDependencies ++= {
val akkaV = "2.4.9"
Seq(
"com.typesafe.akka" %% "akka-http-core" % akkaV,
"com.typesafe.akka" %% "akka-http-spray-json-experimental" % akkaV,
"com.typesafe.akka" %% "akka-http-testkit" % akkaV,
"com.typesafe.akka" %% "akka-stream-kafka" % "0.12",
"org.scalatest" % "scalatest_2.11" % "3.0.0" % "test",
"org.twitter4j" % "twitter4j-core" % "4.0.4",
"com.typesafe.scala-logging" %% "scala-logging" % "3.5.0",
"ch.qos.logback" % "logback-classic" % "1.1.7",
"me.lessis" %% "retry" % "0.2.0",
"org.slf4j" % "log4j-over-slf4j" % "1.7.12" % "test",
"org.antlr" % "ST4" % "4.0.8",
"net.manub" %% "scalatest-embedded-kafka" % "0.7.1" % "test"
)
}
resolvers += "softprops-maven" at "http://dl.bintray.com/content/softprops/maven"
imageNames in docker := Seq(
ImageName(s"jvmbloggers/${name.value}:${getTimestampWithGitHash}")
)
dockerfile in docker := {
// The assembly task generates a fat JAR file
val artifact: File = assembly.value
val artifactTargetPath = s"/app/${artifact.name}"
new Dockerfile {
from("java")
add(artifact, artifactTargetPath)
entryPoint("java", "-jar", artifactTargetPath)
}
}
def getTimestampWithGitHash: String = {
val timeStamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date())
val gitCommit = "git log --pretty=format:%h -n 1".!!.stripLineEnd
s"$timeStamp-$gitCommit"
}