Skip to content

Commit 34dc5d3

Browse files
committed
Remove analyzers and responders in docker image
1 parent 8647850 commit 34dc5d3

File tree

1 file changed

+35
-41
lines changed

1 file changed

+35
-41
lines changed

docker.sbt

+35-41
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
33

44
version in Docker := {
55
version.value match {
6-
case stableVersion(_, _) => version.value
7-
case betaVersion(v1, v2) => v1 + "-0.1RC" + v2
6+
case stableVersion(_, _) => version.value
7+
case betaVersion(v1, v2) => v1 + "-0.1RC" + v2
88
case snapshotVersion(_, _) => version.value + "-SNAPSHOT"
9-
case _ => sys.error("Invalid version: " + version.value)
9+
case _ => sys.error("Invalid version: " + version.value)
1010
}
1111
}
1212
defaultLinuxInstallLocation in Docker := "/opt/cortex"
@@ -16,44 +16,38 @@ dockerEntrypoint := Seq("/opt/cortex/entrypoint")
1616
dockerExposedPorts := Seq(9001)
1717
mappings in Docker ++= Seq(
1818
file("package/docker/entrypoint") -> "/opt/cortex/entrypoint",
19-
file("package/logback.xml") -> "/etc/cortex/logback.xml",
20-
file("package/empty") -> "/var/log/cortex/application.log")
19+
file("package/logback.xml") -> "/etc/cortex/logback.xml",
20+
file("package/empty") -> "/var/log/cortex/application.log"
21+
)
2122
mappings in Docker ~= (_.filterNot {
2223
case (_, filepath) => filepath == "/opt/cortex/conf/application.conf"
2324
})
24-
dockerCommands ~= { dc =>
25-
val (dockerInitCmds, dockerTailCmds) = dc
26-
.flatMap {
27-
case ExecCmd("RUN", "chown", _*) => Some(ExecCmd("RUN", "chown", "-R", "daemon:root", "."))
28-
case Cmd("USER", _) => None
29-
case other => Some(other)
30-
}
31-
.splitAt(4)
32-
dockerInitCmds ++
33-
Seq(
34-
Cmd("USER", "root"),
35-
ExecCmd("RUN", "bash", "-c",
36-
"wget -q -O - https://download.docker.com/linux/static/stable/x86_64/docker-18.09.0.tgz | " +
37-
"tar -xzC /usr/local/bin/ --strip-components 1 && " +
38-
"addgroup --system dockremap && " +
39-
"adduser --system --ingroup dockremap dockremap && " +
40-
"addgroup --system docker && " +
41-
"usermod --append --groups docker daemon &&" +
42-
"echo 'dockremap:165536:65536' >> /etc/subuid && " +
43-
"echo 'dockremap:165536:65536' >> /etc/subgid && " +
44-
"apt-get update && " +
45-
"apt-get upgrade -y && " +
46-
"apt-get install -y --no-install-recommends python-pip python2.7-dev python3-pip python3-dev ssdeep libfuzzy-dev libfuzzy2 libimage-exiftool-perl libmagic1 build-essential git libssl-dev dnsutils iptables && " +
47-
"pip2 install -U pip setuptools && " +
48-
"pip3 install -U pip setuptools && " +
49-
"hash -r && " +
50-
"cd /opt && " +
51-
"git clone https://github.com/TheHive-Project/Cortex-Analyzers.git && " +
52-
"for I in $(find Cortex-Analyzers -name 'requirements.txt'); do pip2 install -r $I; done && " +
53-
"for I in $(find Cortex-Analyzers -name 'requirements.txt'); do pip3 install -r $I || true; done"),
54-
Cmd("ADD", "var", "/var"),
55-
Cmd("ADD", "etc", "/etc"),
56-
ExecCmd("RUN", "chown", "-R", "daemon:root", "/var/log/cortex"),
57-
ExecCmd("RUN", "chmod", "+x", "/opt/cortex/bin/cortex", "/opt/cortex/entrypoint")) ++
58-
dockerTailCmds
59-
}
25+
dockerCommands := Seq(
26+
Cmd("FROM", "openjdk:8"),
27+
Cmd("LABEL", "MAINTAINER=\"TheHive Project <[email protected]>\"", "repository=\"https://github.com/TheHive-Project/TheHive\""),
28+
Cmd("WORKDIR", "/opt/cortex"),
29+
// format: off
30+
Cmd("RUN",
31+
"apt", "update", "&&",
32+
"apt", "upgrade", "-y", "&&",
33+
"apt", "autoclean", "-y", "-q", "&&",
34+
"apt", "autoremove", "-y", "-q", "&&",
35+
"rm", "-rf", "/var/lib/apt/lists/*", "&&",
36+
"(", "type", "groupadd", "1>/dev/null", "2>&1", "&&",
37+
"groupadd", "-g", "1000", "cortex", "||",
38+
"addgroup", "-g", "1000", "-S", "cortex",
39+
")", "&&",
40+
"(", "type", "useradd", "1>/dev/null", "2>&1", "&&",
41+
"useradd", "--system", "--uid", "1000", "--gid", "1000", "cortex", "||",
42+
"adduser", "-S", "-u", "1000", "-G", "cortex", "cortex",
43+
")"),
44+
//format: on
45+
Cmd("ADD", "--chown=root:root", "opt", "/opt"),
46+
Cmd("ADD", "--chown=cortex:cortex", "var", "/var"),
47+
Cmd("ADD", "--chown=cortex:cortex", "etc", "/etc"),
48+
ExecCmd("RUN", "chmod", "+x", "/opt/cortex/bin/cortex", "/opt/cortex/entrypoint"),
49+
Cmd("EXPOSE", "9001"),
50+
Cmd("USER", "thehive"),
51+
ExecCmd("ENTRYPOINT", "/opt/cortex/entrypoint"),
52+
ExecCmd("CMD")
53+
)

0 commit comments

Comments
 (0)