aboutsummaryrefslogtreecommitdiff
path: root/mavigator-server/build.sbt
blob: d43075041ae63c4e7000ea376368b59844b2fbc3 (plain) (blame)
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
import mavigator.{Dependencies, MavigatorBuild, Js}

enablePlugins(SbtTwirl)

MavigatorBuild.defaultSettings

libraryDependencies ++= Seq(
  Dependencies.akkaHttp,
  Dependencies.akkaHttpCore,
  Dependencies.akkaStream,
  Dependencies.flowNative //FIXME runtime dependencies from uav are not included, is this an sbt bug?
)

Js.dependsOnJs(MavigatorBuild.cockpit)

fork in run := true
connectInput in run := true
cancelable in Global := true


/*
 * Deployment configuration
 */
enablePlugins(DockerPlugin)

val filter = ScopeFilter(
  inAnyProject,
  inConfigurations(Compile)
)

dockerfile in docker := {
  val mainclass = (mainClass in Compile in packageBin).value.getOrElse(sys.error("Expected exactly one main class"))

  val jarFiles: List[File] = packageBin.all(filter).value.toList :::
    (fullClasspath in Compile).value.files.toList

  val cp = jarFiles.map{ file =>
    s"/opt/mavigator/lib/${file.getName}"
  }.mkString(":")

  new Dockerfile {
    from("java:8")
    add(jarFiles, "/opt/mavigator/lib/")
    expose(8080)
    entryPoint("java", "-cp", cp, mainclass)
  }
}

buildOptions in docker := BuildOptions(
  pullBaseImage = BuildOptions.Pull.Always,
  removeIntermediateContainers = BuildOptions.Remove.Always
)

imageName in docker := ImageName(s"jodersky/mavigator:${version.value}")