Auto-packaging app in docker

master
Andriy Kushnir (Orhideous) 2019-12-22 14:14:43 +02:00
parent a82b1c2c1c
commit 69381f79c1
No known key found for this signature in database
GPG Key ID: 62E078AB621B0D15
2 changed files with 26 additions and 0 deletions

View File

@ -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,

View File

@ -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")