forked from metarank/metarank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
155 lines (151 loc) · 8.04 KB
/
build.sbt
File metadata and controls
155 lines (151 loc) · 8.04 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import Deps._
lazy val PLATFORM = Option(System.getenv("PLATFORM")).getOrElse("amd64")
ThisBuild / organization := "ai.metarank"
ThisBuild / scalaVersion := "2.13.16"
ThisBuild / version := "0.7.11"
lazy val root = (project in file("."))
.enablePlugins(DockerPlugin)
.configs(IntegrationTest extend Test)
.settings(
Defaults.itSettings,
name := "metarank",
resolvers ++= Seq(
("maven snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/")
),
Test / logBuffered := false,
Test / parallelExecution := false,
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-Xfatal-warnings",
"-release:11"
),
javacOptions ++= Seq(
"-source",
"11",
"-target",
"11"
),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "3.6.1",
"org.scalatest" %% "scalatest" % scalatestVersion % "test,it",
"org.scalactic" %% "scalactic" % scalatestVersion % "test,it",
"org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0" % "test,it",
"ch.qos.logback" % "logback-classic" % "1.5.18",
"io.circe" %% "circe-yaml" % circeYamlVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
"io.circe" %% "circe-parser" % circeVersion,
"com.github.pathikrit" %% "better-files" % "3.9.2",
"org.rogach" %% "scallop" % "5.2.0",
"com.github.blemale" %% "scaffeine" % "5.3.0",
"org.apache.kafka" % "kafka-clients" % "4.0.0",
"org.apache.pulsar" % "pulsar-client" % pulsarVersion excludeAll (
ExclusionRule("org.bouncycastle", "bcprov-ext-jdk18on")
),
"org.apache.pulsar" % "pulsar-client-admin" % pulsarVersion % "test",
"org.http4s" %% "http4s-dsl" % http4sVersion,
"org.http4s" %% "http4s-ember-server" % http4sVersion,
"org.http4s" %% "http4s-ember-client" % http4sVersion,
"org.http4s" %% "http4s-circe" % http4sVersion,
"org.typelevel" %% "log4cats-core" % "2.7.1",
"org.typelevel" %% "log4cats-slf4j" % "2.7.1",
"io.github.metarank" %% "ltrlib" % "0.2.6",
"io.github.metarank" % "lightgbm4j" % "4.6.0-1",
"com.github.ua-parser" % "uap-java" % "1.6.1",
"com.snowplowanalytics" %% "scala-referer-parser" % "2.1.0",
"org.apache.lucene" % "lucene-core" % luceneVersion,
"org.apache.lucene" % "lucene-analysis-common" % luceneVersion,
"org.apache.lucene" % "lucene-analysis-icu" % luceneVersion,
"org.apache.lucene" % "lucene-analysis-smartcn" % luceneVersion,
"org.apache.lucene" % "lucene-analysis-kuromoji" % luceneVersion,
"org.apache.lucene" % "lucene-analysis-stempel" % luceneVersion,
"software.amazon.awssdk" % "kinesis" % awsVersion,
"io.lettuce" % "lettuce-core" % "6.7.1.RELEASE",
"com.google.guava" % "guava" % "33.4.8-jre",
"commons-io" % "commons-io" % "2.19.0",
"io.sentry" % "sentry-logback" % "8.15.1",
"com.fasterxml.util" % "java-merge-sort" % "1.1.0",
"io.prometheus" % "simpleclient" % prometheusVersion,
"io.prometheus" % "simpleclient_hotspot" % prometheusVersion,
"io.prometheus" % "simpleclient_httpserver" % prometheusVersion,
"software.amazon.awssdk" % "s3" % awsVersion,
"software.amazon.awssdk" % "sts" % awsVersion,
"org.apache.commons" % "commons-rng-sampling" % "1.6",
"org.apache.commons" % "commons-rng-simple" % "1.6",
"io.github.metarank" % "librec-core" % "3.0.0-1" excludeAll (
ExclusionRule("org.nd4j", "guava"),
ExclusionRule("org.nd4j", "protobuf"),
ExclusionRule("org.jetbrains.kotlin", "kotlin-stdlib-jdk7"),
ExclusionRule("org.jetbrains.kotlin", "kotlin-stdlib-jdk8"),
ExclusionRule("org.jetbrains.kotlin", "kotlin-stdlib-common")
),
"org.rocksdb" % "rocksdbjni" % "10.2.1",
"org.mapdb" % "mapdb" % "3.1.0" exclude ("net.jpountz.lz4", "lz4"),
"com.github.jelmerk" % "hnswlib-core" % "1.2.1",
"org.slf4j" % "jcl-over-slf4j" % "2.0.17", // librec uses commons-logging, which is JCL
"com.microsoft.onnxruntime" % "onnxruntime" % "1.22.0",
"ai.djl" % "api" % djlVersion,
"ai.djl.huggingface" % "tokenizers" % djlVersion,
"co.fs2" %% "fs2-core" % fs2Version,
"co.fs2" %% "fs2-io" % fs2Version
),
excludeDependencies ++= Seq(
"commons-logging" % "commons-logging"
),
Compile / mainClass := Some("ai.metarank.main.Main"),
Compile / discoveredMainClasses := Seq(),
docker / dockerfile := {
val artifact: File = assembly.value
val artifactTargetPath = s"/app/${artifact.name}"
new Dockerfile {
from(s"--platform=$PLATFORM ubuntu:jammy-20240227")
runRaw(
List(
"apt-get update",
"apt-get install -y --no-install-recommends openjdk-21-jdk-headless htop procps curl inetutils-ping libgomp1 locales",
"sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen",
"rm -rf /var/lib/apt/lists/*"
).mkString(" && ")
)
env(
Map(
"LANG" -> "en_US.UTF-8 ",
"LANGUAGE" -> "en_US:en ",
"LC_ALL" -> "en_US.UTF-8 "
)
)
add(new File("deploy/metarank.sh"), "/metarank.sh")
add(artifact, artifactTargetPath)
entryPoint("/metarank.sh")
cmd("--help")
}
},
docker / imageNames := Seq(
ImageName(s"metarank/metarank:${version.value}-$PLATFORM"),
ImageName(s"metarank/metarank:snapshot")
),
docker / buildOptions := BuildOptions(
removeIntermediateContainers = BuildOptions.Remove.Always,
pullBaseImage = BuildOptions.Pull.Always
),
ThisBuild / assemblyMergeStrategy := {
case PathList("module-info.class") => MergeStrategy.discard
case "META-INF/io.netty.versions.properties" => MergeStrategy.first
case "META-INF/MANIFEST.MF" => MergeStrategy.discard
case "META-INF/versions/9/OSGI-INF/MANIFEST.MF" => MergeStrategy.discard
case "META-INF/native-image/reflect-config.json" => MergeStrategy.concat
case "META-INF/native-image/io.netty/netty-common/native-image.properties" => MergeStrategy.first
case "META-INF/native-image/io.netty/netty-transport/reflect-config.json" => MergeStrategy.first
case "META-INF/okio.kotlin_module" => MergeStrategy.first
case "findbugsExclude.xml" => MergeStrategy.discard
case "log4j2-test.properties" => MergeStrategy.discard
case x if x.endsWith("/module-info.class") => MergeStrategy.discard
case x if x.startsWith("META-INF/versions/9/org/yaml/snakeyaml/internal") => MergeStrategy.discard
case x =>
val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
oldStrategy(x)
},
assembly / assemblyJarName := "metarank.jar"
)