forked from mrfyda/codacy-flawfinder
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
executable file
·43 lines (31 loc) · 1.12 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
import com.typesafe.sbt.packager.docker.Cmd
name := "codacy-flawfinder"
scalaVersion := "2.13.8"
libraryDependencies ++= Seq(
"com.codacy" %% "codacy-engine-scala-seed" % "5.0.1",
"com.github.pathikrit" %% "better-files" % "3.8.0"
)
Compile / mainClass := Some("codacy.Engine")
enablePlugins(JavaAppPackaging)
enablePlugins(DockerPlugin)
Universal / mappings ++= {
(Compile / resourceDirectory) map { resourceDir: File =>
val src = resourceDir / "docs"
val dest = "/docs"
for {
path <- src.allPaths.get if !path.isDirectory
} yield path -> path.toString.replaceFirst(src.toString, dest)
}
}.value
val dockerUser = "docker"
val dockerGroup = "docker"
Docker / daemonUser := dockerUser
Docker / daemonGroup := dockerGroup
dockerBaseImage := "codacy-flawfinder-base"
dockerEntrypoint := Seq(s"/opt/docker/bin/${name.value}")
dockerCommands := dockerCommands.value.flatMap {
case cmd @ Cmd("WORKDIR", _) => Seq(Cmd("WORKDIR", "/opt/docker"))
case cmd @ Cmd("ADD", _) =>
Seq(Cmd("RUN", s"adduser -u 2004 -D $dockerUser"), cmd, Cmd("RUN", "mv /opt/docker/docs /docs"))
case other => List(other)
}