This repository has been archived by the owner on Feb 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
71 lines (53 loc) · 2.11 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
import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
name := """codacy-engine-findbugs-security"""
version := "1.0.0"
val languageVersion = "2.12.7"
scalaVersion := languageVersion
resolvers ++= Seq(
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases"
)
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % "1.0.5" withSources(),
"com.codacy" %% "codacy-engine-scala-seed" % "3.0.9"
)
enablePlugins(JavaAppPackaging)
enablePlugins(DockerPlugin)
version in Docker := "1.0"
val findBugsVersion = "1.7.1"
val installAll =
s"""echo "deb http://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list &&
|apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823 &&
|apt-get -y update &&
|apt-get -y install maven &&
|apt-get -y install sbt &&
|wget https://github.com/find-sec-bugs/find-sec-bugs/releases/download/version-$findBugsVersion/findsecbugs-cli-$findBugsVersion.zip &&
|mkdir /opt/docker/findbugs &&
|unzip findsecbugs-cli-$findBugsVersion.zip -d /opt/docker/findbugs &&
|chmod +x /opt/docker/findbugs/findsecbugs.sh""".stripMargin.replaceAll(System.lineSeparator(), " ")
mappings.in(Universal) ++= resourceDirectory
.in(Compile)
.map { resourceDir: File =>
val src = resourceDir / "docs"
val dest = "/docs"
(for {
path <- better.files.File(src.toPath).listRecursively()
if !path.isDirectory
} yield path.toJava -> path.toString.replaceFirst(src.toString, dest)).toSeq
}
.value
val dockerUser = "docker"
val dockerGroup = "docker"
daemonUser in Docker := dockerUser
daemonGroup in Docker := dockerGroup
dockerBaseImage := "rtfpessoa/ubuntu-jdk8"
dockerCommands := dockerCommands.value.flatMap {
case cmd@(Cmd("ADD", _)) => List(
Cmd("RUN", "adduser --uid 2004 --disabled-password --gecos \"\" docker"),
cmd,
Cmd("RUN", installAll),
Cmd("RUN", "mv /opt/docker/docs /docs"),
ExecCmd("RUN", Seq("chown", "-R", s"$dockerUser:$dockerGroup", "/docs"): _*)
)
case other => List(other)
}