Skip to content

Commit

Permalink
fix configuration files paths in native docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
micossow committed Nov 1, 2023
1 parent af0a448 commit afe19e4
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import com.amazonaws.services.s3.model.PutObjectResult
import com.softwaremill.Publish.ossPublishSettings
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.typesafe.sbt.packager.docker._
import sbt.Keys.javaOptions
import sbt.internal.util.complete.Parsers.spaceDelimited
import scoverage.ScoverageKeys.*

import scala.sys.process.Process

val v2_12 = "2.12.15"
Expand Down Expand Up @@ -213,9 +205,6 @@ lazy val server: Project = (project in file("server"))
coverageMinimumStmtTotal := 52,
// s3 upload
s3Upload := {
import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
import com.amazonaws.services.s3.AmazonS3ClientBuilder
import com.amazonaws.services.s3.model.{CannedAccessControlList, PutObjectRequest}

val bucketName = "softwaremill-public"

Expand Down Expand Up @@ -337,13 +326,13 @@ lazy val nativeServer: Project = (project in file("native-server"))
// We want to include the image generated in stage0 around the COPY commands
val lastIndexOfCopy = commands.lastIndexWhere {
case Cmd("COPY", _) => true
case _ => false
case _ => false
}

val (front, back) = commands.splitAt(lastIndexOfCopy + 1)

val updatedCommands = front.filter {
case Cmd("COPY", args@_*) =>
case Cmd("COPY", args @ _*) =>
// We do not want to include jar layers (the one with number based root path: /1, /2, /3, etc.)
args.head.startsWith("opt")
case _ => true
Expand All @@ -356,17 +345,17 @@ lazy val nativeServer: Project = (project in file("native-server"))
},
Docker / defaultLinuxInstallLocation := "/opt/elasticmq",
Docker / mappings ++= Seq(
(baseDirectory.value / ".." / "server" / "docker" / "elasticmq.conf") -> "/opt/elasticmq/elasticmq.conf",
(baseDirectory.value / ".." / "server" / "src" / "main" / "resources" / "logback.xml") -> "/opt/elasticmq/logback.xml",
) ++ sbt.Path.contentOf(baseDirectory.value / ".." / "ui" / "build").map {
case (file, mapping) => (file, "/opt/elasticmq/" + mapping)
(baseDirectory.value / ".." / "server" / "docker" / "elasticmq.conf") -> "/opt/elasticmq.conf",
(baseDirectory.value / ".." / "server" / "src" / "main" / "resources" / "logback.xml") -> "/opt/logback.xml"
) ++ sbt.Path.contentOf(baseDirectory.value / ".." / "ui" / "build").map { case (file, mapping) =>
(file, "/opt/elasticmq/" + mapping)
},
dockerEntrypoint := Seq(
"/sbin/tini", // tini makes it possible to kill the process with Cmd+C/Ctrl+C when running in interactive mode (-it)
"--",
"/opt/elasticmq/bin/elasticmq-native-server",
"-Dconfig.file=/opt/elasticmq/elasticmq.conf",
"-Dlogback.configurationFile=/opt/elasticmq/logback.xml"
"-Dconfig.file=/opt/elasticmq.conf",
"-Dlogback.configurationFile=/opt/logback.xml"
),
dockerUpdateLatest := {
!version.value.toLowerCase.contains("rc")
Expand Down

0 comments on commit afe19e4

Please sign in to comment.