Skip to content

Commit

Permalink
Test containerization
Browse files Browse the repository at this point in the history
  • Loading branch information
kwalcock committed Feb 3, 2023
1 parent 8fe01f5 commit 51730f5
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 259 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Expand Up @@ -37,4 +37,5 @@ lazy val webapp = project
// scala211 isn't compiling and complains on twirlCompileTemplates.
crossScalaVersions := Seq(scala212)
)


addCommandAlias("dockerizeWebapp", ";webapp/docker:publishLocal")
Binary file modified docs/webapp_full.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion main/build.sbt
Expand Up @@ -60,7 +60,7 @@ libraryDependencies ++= {
// Instead, all code makes use of the Java interface.
"org.slf4j" % "slf4j-api" % "1.7.32", // MIT
// Local logging is provided here but not published.
"ch.qos.logback" % "logback-classic" % "1.2.8", // up to 1.2.8; less than 1.2 is vulnerable
"ch.qos.logback" % "logback-classic" % "1.2.8", // up to 1.2.8; less than 1.2 is vulnerable
// testing
"org.scalatest" %% "scalatest" % "3.2.10" % Test, // Apache-2.0
// trained models for local ML models used in both main and corenlp
Expand Down
41 changes: 0 additions & 41 deletions webapp/Docker/Dockerfile

This file was deleted.

41 changes: 0 additions & 41 deletions webapp/Docker/DockerfileRun

This file was deleted.

54 changes: 0 additions & 54 deletions webapp/Docker/DockerfileRunProd

This file was deleted.

67 changes: 0 additions & 67 deletions webapp/Docker/DockerfileStage

This file was deleted.

28 changes: 0 additions & 28 deletions webapp/Docker/README.md

This file was deleted.

10 changes: 1 addition & 9 deletions webapp/README.md
Expand Up @@ -11,15 +11,7 @@ One can start the webapp directly from within `sbt` in development mode with the

## Dockerization

The subdirectory `Docker` contains `Dockerfiles` to generate images in
multiple varieties along with documentation in the [Docker/README.md](./Docker/README.md) file.

In recent versions of processors there is also a `docker.sbt` file which allows one
to build an image from within `sbt`. This method tends to be much faster than
the alternatives. A command alias `dockerizeWebapp` has been set up to first cache
geonames (in ./cache/geonames) and then construct the image including the names.
If the cache has already been constructed, one can use the command
`webapp/docker:publishLocal` to just build the image.
There is also a `docker.sbt` file which allows one to build an image from within `sbt`. A command alias `dockerizeWebapp` has been set up for it.

To run the resulting image, use a command like
```bash
Expand Down
2 changes: 1 addition & 1 deletion webapp/build.sbt
Expand Up @@ -6,7 +6,7 @@ libraryDependencies ++= Seq(
guice,
// Newer than 4.0.3 does not work for Scala 2.11. There is no Scala 3 version.
"org.scalatestplus.play" %% "scalatestplus-play" % "4.0.3" % Test // up to 5.1.0
) // .map(_.cross(CrossVersion.for3Use2_13))
)

Compile / packageBin / mappings := {
val filtered = (Compile / packageBin / mappings).value.filter {
Expand Down
16 changes: 0 additions & 16 deletions webapp/docker.sbt
@@ -1,5 +1,4 @@
import NativePackagerHelper._
import com.typesafe.sbt.packager.MappingsHelper.directory
import com.typesafe.sbt.packager.docker.{Cmd, CmdLike, DockerChmodType, DockerPermissionStrategy}

val topDir = "/processors/webapp"
Expand Down Expand Up @@ -47,19 +46,4 @@ dockerCommands := dockerCommands.value.flatMap { dockerCommand: CmdLike =>
}
}

def moveDir(dirname: String): Seq[(File, String)] = {
val dir = file(dirname)
val result = dir
.**(AllPassFilter)
.pair(relativeTo(dir.getParentFile))
.map { case (file, _) => (file, file.getPath) }

// result.foreach { case (file, string) =>
// println(s"$file -> $string")
// }
result
}

Universal / mappings ++= moveDir("./cache/geonames")

Global / excludeLintKeys += Docker / dockerBaseImage

0 comments on commit 51730f5

Please sign in to comment.