-
Notifications
You must be signed in to change notification settings - Fork 159
/
build.sbt
115 lines (92 loc) · 3.35 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
ThisBuild / organization := "io.conduktor"
ThisBuild / homepage := Some(url("https://github.com/conduktor/kafka-security-manager"))
ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
ThisBuild /developers := List(
Developer(
"conduktor",
"Stephane Maarek",
"conduktor@users.noreply.github.com",
url("https://github.com/conduktor")
)
)
import scala.sys.process.Process
name := "kafka-security-manager"
version := "1.1.0-SNAPSHOT"
scalaVersion := "2.12.15"
lazy val ensureDockerBuildx = taskKey[Unit]("Ensure that docker buildx configuration exists")
lazy val dockerBuildWithBuildx = taskKey[Unit]("Build docker images using buildx")
lazy val dockerBuildxSettings = Seq(
ensureDockerBuildx := {
if (Process("docker buildx inspect multi-arch-builder").! == 1) {
Process("docker buildx create --use --name multi-arch-builder", baseDirectory.value).!
}
},
dockerBuildWithBuildx := {
streams.value.log("Building and pushing image with Buildx")
dockerAliases.value.foreach(alias =>
Process(
"docker buildx build --platform=linux/arm64,linux/amd64 --push -t " + alias + " .",
baseDirectory.value / "target" / "docker" / "stage"
).!
)
},
Docker / publish := Def
.sequential(
Docker / publishLocal,
ensureDockerBuildx,
dockerBuildWithBuildx
)
.value
)
lazy val root = (project in file("."))
.enablePlugins(JavaAppPackaging)
.enablePlugins(DockerPlugin)
.enablePlugins(ClasspathJarPlugin)
.enablePlugins(AshScriptPlugin)
.settings(dockerBuildxSettings)
resolvers ++= Seq(
"Artima Maven Repository" at "https://repo.artima.com/releases",
Resolver.bintrayRepo("beyondthelines", "maven")
)
libraryDependencies ++= Seq(
// kafka
"org.apache.kafka" %% "kafka" % "2.8.1",
"io.github.embeddedkafka" %% "embedded-kafka" % "2.8.1" % "test",
"io.findify" %% "s3mock" % "0.2.6" % "test",
//netty
"io.netty" % "netty-handler" % "4.1.72.Final",
"org.apache.kafka" % "kafka-clients" % "2.5.0", // needed explicitly for proper classPath
"org.apache.kafka" % "kafka-clients" % "2.5.0" % Test classifier "test",
// test
"org.scalatest" %% "scalatest" % "3.0.5" % Test,
"org.scalamock" %% "scalamock" % "5.1.0" % Test,
"com.github.tomakehurst" % "wiremock" % "2.27.2" % Test,
// logging
"org.slf4j" % "slf4j-api" % "1.7.32",
"org.slf4j" % "slf4j-log4j12" % "1.7.32",
"org.apache.logging.log4j" % "log4j" % "2.17.1",
// config
"com.typesafe" % "config" % "1.3.3",
// parsers
"com.github.tototoshi" %% "scala-csv" % "1.3.5",
"io.circe" %% "circe-yaml" % "0.14.1",
"io.circe" %% "circe-generic" % "0.14.1",
// APIs
"org.skinny-framework" %% "skinny-http-client" % "2.3.7",
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.1",
// AWS SDK to access S3
"com.amazonaws" % "aws-java-sdk-s3" % "1.11.385",
// Google Auth
"com.google.auth" % "google-auth-library-oauth2-http" % "0.25.5"
)
Compile / mainClass := Some("io.conduktor.ksm.KafkaSecurityManager")
Test / parallelExecution := false
// Docker stuff
dockerRepository := Some("conduktor")
dockerUpdateLatest := true
dockerBaseImage := "openjdk:11-jre-slim"
assembly / assemblyMergeStrategy := {
case PathList("META-INF", _@_*) => MergeStrategy.discard
case _ => MergeStrategy.first
}
assembly / assemblyJarName := s"${name.value}-${version.value}.jar"