Docker and JVM Configuration

Warning

Lightbend Orchestration is no longer actively developed and will reach its End of Life on April 15, 2020.

We recommend Migrating to the Improved Kubernetes Deployment Experience.

The Docker image is the deployment unit of choice and powers a wide variety of orchestration systems, including Kubernetes and DC/OS. The docker images created by Lightbend Orchestration offer the following default configuration:

  1. Minimal base-image, openjdk:alpine, to reduce the size of the images produced.
  2. JVM’s Docker CPU and memory limits are enabled, as discussed on this Oracle Blog Post.

For sbt-reactive-app 1.5.0 and later, rpPackagingDockerCommmands setting can be used to append either additonal packages or to build on an alternative base image.

Additional Alpine packages

import com.typesafe.sbt.packager.docker._

ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.7"

lazy val root = (project in file("."))
  .enablePlugins(SbtReactiveAppPlugin)
  .settings(
    name := "alpine-packages",
    rpPackagingDockerCommmands := Vector(
      Cmd("RUN", "/sbin/apk", "add", "--no-cache", "bash", "coreutils", "shadow"))
  )

Debian slim example

import com.typesafe.sbt.packager.docker._

ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.7"

lazy val root = (project in file("."))
  .enablePlugins(SbtReactiveAppPlugin)
  .settings(
    name := "debian-packages",
    dockerBaseImage := "openjdk:8-jdk-slim",
    // override the apk packaging
    rpPackagingDockerCommmands := Vector(),

    // optionally add apt-get packages
    // rpPackagingDockerCommmands := Vector(
    //   Cmd("RUN", "/usr/bin/apt-get", "install", "-y", "bash")),
  )