diff --git a/build.sbt b/build.sbt index 0d047e92f..ad1e1d11d 100644 --- a/build.sbt +++ b/build.sbt @@ -41,7 +41,7 @@ lazy val streamCommon = project lazy val streamKinesis = project .in(file("modules/stream/kinesis")) - .enablePlugins(JavaAppPackaging, DockerPlugin) + .enablePlugins(JavaAppPackaging, SnowplowDockerPlugin) .settings(streamKinesisBuildSettings) .settings(libraryDependencies ++= streamKinesisDependencies) .settings(excludeDependencies ++= exclusions) @@ -49,7 +49,7 @@ lazy val streamKinesis = project lazy val streamKinesisDistroless = project .in(file("modules/distroless/stream/kinesis")) - .enablePlugins(JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (streamKinesis / sourceDirectory).value) .settings(streamKinesisDistrolessBuildSettings) .settings(libraryDependencies ++= streamKinesisDependencies) @@ -58,7 +58,7 @@ lazy val streamKinesisDistroless = project lazy val streamKafka = project .in(file("modules/stream/kafka")) - .enablePlugins(JavaAppPackaging, DockerPlugin) + .enablePlugins(JavaAppPackaging, SnowplowDockerPlugin) .settings(streamKafkaBuildSettings) .settings(libraryDependencies ++= streamKafkaDependencies) .settings(excludeDependencies ++= exclusions) @@ -66,7 +66,7 @@ lazy val streamKafka = project lazy val streamKafkaDistroless = project .in(file("modules/distroless/stream/kafka")) - .enablePlugins(JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (streamKafka / sourceDirectory).value) .settings(streamKafkaDistrolessBuildSettings) .settings(libraryDependencies ++= streamKafkaDependencies) @@ -75,7 +75,7 @@ lazy val streamKafkaDistroless = project lazy val streamNsq = project .in(file("modules/stream/nsq")) - .enablePlugins(JavaAppPackaging, DockerPlugin) + .enablePlugins(JavaAppPackaging, SnowplowDockerPlugin) .settings(streamNsqBuildSettings) .settings(libraryDependencies ++= streamNsqDependencies) .settings(excludeDependencies ++= exclusions) @@ -83,7 +83,7 @@ lazy val streamNsq = project lazy val streamNsqDistroless = project .in(file("modules/distroless/stream/nsq")) - .enablePlugins(JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (streamNsq / sourceDirectory).value) .settings(streamNsqDistrolessBuildSettings) .settings(libraryDependencies ++= streamNsqDependencies) @@ -108,7 +108,7 @@ lazy val commonFs2 = project lazy val pubsub = project .in(file("modules/pubsub")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDockerPlugin) .settings(pubsubBuildSettings) .settings(libraryDependencies ++= pubsubDependencies) .settings(excludeDependencies ++= exclusions) @@ -117,7 +117,7 @@ lazy val pubsub = project lazy val pubsubDistroless = project .in(file("modules/distroless/pubsub")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (pubsub / sourceDirectory).value) .settings(pubsubDistrolessBuildSettings) .settings(libraryDependencies ++= pubsubDependencies) @@ -128,7 +128,7 @@ lazy val pubsubDistroless = project lazy val kinesis = project .in(file("modules/kinesis")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDockerPlugin) .settings(kinesisBuildSettings) .settings(libraryDependencies ++= kinesisDependencies ++ Seq( // integration tests dependencies @@ -144,7 +144,7 @@ lazy val kinesis = project lazy val kinesisDistroless = project .in(file("modules/distroless/kinesis")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (kinesis / sourceDirectory).value) .settings(kinesisDistrolessBuildSettings) .settings(libraryDependencies ++= kinesisDependencies) @@ -154,7 +154,7 @@ lazy val kinesisDistroless = project lazy val kafka = project .in(file("modules/kafka")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDockerPlugin) .settings(kafkaBuildSettings) .settings(libraryDependencies ++= kafkaDependencies ++ Seq( // integration tests dependencies @@ -168,7 +168,7 @@ lazy val kafka = project lazy val kafkaDistroless = project .in(file("modules/distroless/kafka")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (kafka / sourceDirectory).value) .settings(kafkaDistrolessBuildSettings) .settings(libraryDependencies ++= kafkaDependencies) @@ -183,7 +183,7 @@ lazy val bench = project lazy val rabbitmq = project .in(file("modules/rabbitmq")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDockerPlugin) .settings(rabbitmqBuildSettings) .settings(libraryDependencies ++= rabbitmqDependencies) .settings(excludeDependencies ++= exclusions) @@ -192,7 +192,7 @@ lazy val rabbitmq = project lazy val rabbitmqDistroless = project .in(file("modules/distroless/rabbitmq")) - .enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin, LauncherJarPlugin) + .enablePlugins(BuildInfoPlugin, JavaAppPackaging, SnowplowDistrolessDockerPlugin) .settings(sourceDirectory := (rabbitmq / sourceDirectory).value) .settings(rabbitmqDistrolessBuildSettings) .settings(libraryDependencies ++= rabbitmqDependencies) diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index 53c54743d..a916b296f 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -22,7 +22,6 @@ import sbtbuildinfo.BuildInfoPlugin.autoImport.{BuildInfoKey, buildInfoKeys, bui import sbtdynver.DynVerPlugin.autoImport._ import com.typesafe.sbt.SbtNativePackager.autoImport._ import com.typesafe.sbt.packager.archetypes.jar.LauncherJarPlugin.autoImport.packageJavaLauncherJar -import com.typesafe.sbt.packager.docker.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._ @@ -194,28 +193,14 @@ object BuildSettings { ) lazy val dockerSettingsFocal = Seq( - Universal / javaOptions ++= Seq("-Dnashorn.args=--language=es6"), - Docker / maintainer := "Snowplow Analytics Ltd. ", - dockerBaseImage := "eclipse-temurin:11-jre-focal", - dockerRepository := Some("snowplow"), - Docker / daemonUser := "snowplow", - Docker / defaultLinuxInstallLocation := "/home/snowplow", - dockerUpdateLatest := true + Universal / javaOptions ++= Seq("-Dnashorn.args=--language=es6") ) lazy val dockerSettingsDistroless = Seq( - Universal / javaOptions ++= Seq("-Dnashorn.args=--language=es6"), - Docker / maintainer := "Snowplow Analytics Ltd. ", - 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.copy(tag = dockerAlias.value.tag.map(t => s"$t-distroless")), - dockerUpdateLatest := false + dockerEntrypoint := { + val orig = dockerEntrypoint.value + orig.head +: "-Dnashorn.args=--language=es6" +: orig.tail + } ) // TESTS diff --git a/project/plugins.sbt b/project/plugins.sbt index a7d28e345..dfa819c73 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,9 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") -addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.2") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") +addSbtPlugin("com.snowplowanalytics" % "sbt-snowplow-release" % "0.1.0")