-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish distroless docker image (close #258)
- Loading branch information
Showing
5 changed files
with
91 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,12 @@ | |
import sbt._ | ||
import Keys._ | ||
|
||
import com.typesafe.sbt.packager.Keys._ | ||
import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport.Docker | ||
import com.typesafe.sbt.packager.docker._ | ||
import com.typesafe.sbt.SbtNativePackager.autoImport._ | ||
import com.typesafe.sbt.packager.archetypes.jar.LauncherJarPlugin.autoImport.packageJavaLauncherJar | ||
import com.typesafe.sbt.packager.docker.{Cmd, DockerPermissionStrategy} | ||
import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport._ | ||
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport._ | ||
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport._ | ||
|
||
// Scoverage plugin | ||
import scoverage.ScoverageKeys._ | ||
|
@@ -47,15 +50,29 @@ object BuildSettings { | |
} | ||
) | ||
|
||
lazy val dockerSettings = Seq( | ||
lazy val dockerSettingsFocal = Seq( | ||
Docker / maintainer := "Snowplow Analytics Ltd. <[email protected]>", | ||
Docker / daemonUser := "daemon", | ||
Docker / packageName := "snowplow/snowplow-s3-loader", | ||
dockerBaseImage := "eclipse-temurin:11-jre-focal", | ||
dockerUpdateLatest := true, | ||
) | ||
|
||
lazy val lzoDockerSettings = Seq( | ||
lazy val dockerSettingsDistroless = Seq( | ||
Docker / maintainer := "Snowplow Analytics Ltd. <[email protected]>", | ||
dockerBaseImage := "gcr.io/distroless/java11-debian11:nonroot", | ||
Docker / daemonUser := "nonroot", | ||
Docker / daemonGroup := "nonroot", | ||
dockerRepository := Some("snowplow"), | ||
Docker / daemonUserUid := None, | ||
Docker / defaultLinuxInstallLocation := "/home/snowplow", | ||
dockerEntrypoint := Seq("java", "-jar",s"/home/snowplow/lib/${(packageJavaLauncherJar / artifactPath).value.getName}"), | ||
dockerPermissionStrategy := DockerPermissionStrategy.CopyChown, | ||
dockerAlias := dockerAlias.value.withTag(Some(version.value + "-distroless")), | ||
dockerUpdateLatest := false | ||
) | ||
|
||
lazy val lzoDockerSettingsFocal = Seq( | ||
dockerCommands := { | ||
val installLzo = Seq(Cmd("RUN", "mkdir -p /var/lib/apt/lists/partial && apt-get update && apt-get install -y lzop && apt-get purge -y")) | ||
val (h, t) = dockerCommands.value.splitAt(dockerCommands.value.size-4) | ||
|
@@ -112,9 +129,18 @@ object BuildSettings { | |
scalafmtOnCompile := false | ||
) | ||
|
||
lazy val commonSettings = basicSettings ++ scalifySettings ++ sbtAssemblySettings ++ dockerSettings ++ addExampleConfToTestCp | ||
lazy val commonSettings = basicSettings ++ scalifySettings ++ sbtAssemblySettings ++ addExampleConfToTestCp | ||
|
||
lazy val mainSettings = commonSettings ++ dockerSettingsFocal ++ Seq( | ||
name := "snowplow-s3-loader" | ||
) | ||
|
||
lazy val distrolessSettings = commonSettings ++ dockerSettingsDistroless ++ Seq( | ||
name := "snowplow-s3-loader" | ||
) | ||
|
||
lazy val lzoSettings = lzoDockerSettings ++ Seq( | ||
lazy val lzoSettings = commonSettings ++ lzoDockerSettingsFocal ++ Seq( | ||
name := "snowplow-s3-loader-lzo", | ||
Compile / discoveredMainClasses := Seq(), | ||
Compile / mainClass := Some("com.snowplowanalytics.s3.loader.lzo.Main") | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters