Auto-packaging app in docker
parent
a82b1c2c1c
commit
69381f79c1
24
build.sbt
24
build.sbt
|
@ -1,3 +1,5 @@
|
|||
enablePlugins(DockerPlugin)
|
||||
|
||||
val Http4sVersion = "0.20.8"
|
||||
val CirceVersion = "0.11.1"
|
||||
val LogbackVersion = "1.2.3"
|
||||
|
@ -10,6 +12,28 @@ name := "twicher"
|
|||
version := "0.1.0-SNAPSHOT"
|
||||
scalaVersion := "2.12.8"
|
||||
|
||||
dockerfile in docker := {
|
||||
val artifact: File = assembly.value
|
||||
val artifactTargetPath = s"/app/${artifact.name}"
|
||||
|
||||
new Dockerfile {
|
||||
from("openjdk:11-jre")
|
||||
add(artifact, artifactTargetPath)
|
||||
env("TWICHER_DIR", "/data")
|
||||
volume("/data")
|
||||
entryPoint("java", "-jar", artifactTargetPath)
|
||||
}
|
||||
}
|
||||
|
||||
imageNames in docker := Seq(
|
||||
ImageName(s"${organization.value}/${name.value}:latest"),
|
||||
ImageName(
|
||||
namespace = Some(organization.value),
|
||||
repository = name.value,
|
||||
tag = Some("v" + version.value)
|
||||
)
|
||||
)
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"org.http4s" %% "http4s-blaze-server" % Http4sVersion,
|
||||
"org.http4s" %% "http4s-circe" % Http4sVersion,
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.3")
|
||||
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
|
||||
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.5.0")
|
||||
|
|
Loading…
Reference in New Issue