Commit 0842f005 authored by Canran Chen's avatar Canran Chen

compile before building the docker

parent 249b60a7
File added
import com.typesafe.sbt.packager.docker
import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import com.typesafe.sbt.packager.docker._
import NativePackagerHelper._
import scala.collection.mutable
......@@ -67,25 +69,31 @@ lazy val server = project.in(file("server")) settings (defaultSettings) settings
)
) dependsOn (shared) enablePlugins (ScalatraPlugin)
lazy val application = project.in(file("application")) settings (defaultSettings) dependsOn (server) enablePlugins (JavaServerAppPackaging) settings(
dockerCommands := Seq(
Cmd("FROM", "gafiatulin/alpine-sbt as simop"),
Cmd("RUN", "apk update && apk add bash git sudo nodejs-npm"),
Cmd("RUN", "adduser connect -g \"\" -D -h /var/connect/"),
Cmd("USER", "connect"),
Cmd("RUN", "cd /var/connect && git clone https://gitlab.openmole.org/openmole/openmole-connect && cd openmole-connect && sbt go")
) ++ dockerCommands.value.dropRight(3) ++ Seq(
Cmd("COPY", "--from=simop", "--chown=root:root", "/var/connect/openmole-connect/application/target/webapp", "/opt/docker/application/target/webapp"),
Cmd("USER", "1001:0"),
ExecCmd("ENTRYPOINT", "/opt/docker/bin/application")
lazy val application = project.in(file("application")) settings (defaultSettings) dependsOn (server) enablePlugins (JavaServerAppPackaging) enablePlugins (DockerPlugin) settings(
mappings in Docker ++= Seq(
(fullOptJS in client in Compile).value.data -> "/opt/docker/application/target/webapp/js/connect.js",
(dependencyFile in client in Compile).value -> "/opt/docker/application/target/webapp/js/connect-deps.js",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "icomoon.eot" -> "/opt/docker/application/target/webapp/fonts/icomoon.eot",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "icomoon.svg" -> "/opt/docker/application/target/webapp/fonts/icomoon.svg",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "icomoon.ttf" -> "/opt/docker/application/target/webapp/fonts/icomoon.ttf",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "icomoon.woff" -> "/opt/docker/application/target/webapp/fonts/icomoon.woff",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "glyphicons-halflings-regular.eot" -> "/opt/docker/application/target/webapp/fonts/glyphicons-halflings-regular.eot",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "glyphicons-halflings-regular.svg" -> "/opt/docker/application/target/webapp/fonts/glyphicons-halflings-regular.svg",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "glyphicons-halflings-regular.ttf" -> "/opt/docker/application/target/webapp/fonts/glyphicons-halflings-regular.ttf",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "glyphicons-halflings-regular.woff" -> "/opt/docker/application/target/webapp/fonts/glyphicons-halflings-regular.woff",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "glyphicons-halflings-regular.woff2" -> "/opt/docker/application/target/webapp/fonts/glyphicons-halflings-regular.woff2",
(baseDirectory in target).value / "target" / "webapp" / "fonts" / "gi.otf" -> "/opt/docker/application/target/webapp/fonts/gi.otf",
(baseDirectory in target).value / "target" / "webapp" / "css" / "style.css" -> "/opt/docker/application/target/webapp/css/style.css",
(baseDirectory in target).value / "target" / "webapp" / "css" / "deps.css" -> "/opt/docker/application/target/webapp/css/deps.css",
(baseDirectory in target).value / "target" / "webapp" / "img" / "logo.png" -> "/opt/docker/application/target/webapp/img/logo.png",
(baseDirectory in target).value / "target" / "webapp" / "WEB-INF" / "web.xml" -> "/opt/docker/application/target/webapp/WEB-INF/web.xml"
),
dockerCommands := dockerCommands.value,
packageName in Docker := "openmole-connect",
organization in Docker := "openmole"
)
lazy val bootstrap = project.in(file("target/bootstrap")) settings (defaultSettings) settings (
go := {
......
sbt.version=1.2.8
sbt.version=1.3.8
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment