<commit_before>import _root_.sbtdocker.DockerPlugin.autoImport._
import sbt._
import sbtdocker.ImageName

val scalaV = "2.11.8"
val Akka = "2.4.11"

val Version = "0.2"

name := "docker-cluster"
version := Version
scalacOptions in(Compile, console) := Seq("-feature", "-Xfatal-warnings", "-deprecation", "-unchecked")
scalaVersion := scalaV

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % Akka,
  "com.typesafe.akka" %% "akka-cluster" % Akka,
  "com.typesafe.akka" %% "akka-http-experimental" % Akka,
  "com.typesafe.akka" %% "akka-cluster-metrics" % Akka,
  "com.typesafe.akka" %% "akka-stream" % Akka,
  "com.typesafe.akka" %% "akka-slf4j" % Akka,
  "io.spray" %% "spray-json" % "1.3.2",
  "ch.qos.logback" % "logback-classic" % "1.1.2",
  "com.typesafe.akka" %% "akka-stream-kafka" % "0.13"
)

enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging)

mainClass in assembly := Some("demo.Application")

assemblyJarName in assembly := s"${name.value}-${version.value}.jar"

// Resolve duplicates for Sbt Assembly
assemblyMergeStrategy in assembly := {
  case PathList(xs @ _*) if xs.last == "io.netty.versions.properties" => MergeStrategy.rename
  case other => (assemblyMergeStrategy in assembly).value(other)
}

imageNames in docker := Seq(ImageName(namespace = Some("haghard"), repository = name.value, tag = Some(version.value)))

buildOptions in docker := BuildOptions(cache = false,
  removeIntermediateContainers = BuildOptions.Remove.Always,
  pullBaseImage = BuildOptions.Pull.Always)

dockerfile in docker := {
  val baseDir = baseDirectory.value
  val artifact: File = assembly.value

  val imageAppBaseDir = "/app"
  val configDir = "conf"

  val artifactTargetPath = s"$imageAppBaseDir/${artifact.name}"

  val seedConfigSrc = baseDir / "src" / "main" / "resources" / "seed-node.conf"
  val workerConfigSrc = baseDir / "src" / "main" / "resources" / "worker-node.conf"


  val seedConfigTarget = s"${imageAppBaseDir}/${configDir}/seed-node.conf"
  val workerConfigTarget = s"${imageAppBaseDir}/${configDir}/worker-node.conf"

  new sbtdocker.mutable.Dockerfile {
    from("openjdk:8-jre")
    maintainer("haghard")

    env("VERSION", Version)
    workDir(imageAppBaseDir)
    runRaw("ls -la")

    copy(artifact, artifactTargetPath)
    copy(seedConfigSrc, seedConfigTarget)
    copy(workerConfigSrc, workerConfigTarget)

    if (System.getenv("node.type") == "seed") {
      val javaOpts = s"-Xmx1024m -XX:+UseG1GC -DseedHost=${System.getenv("SEED_NAME")} -DseedPort=${System.getenv("AKKA_PORT")} -DhttpPort=${System.getenv("HTTP_PORT")}"
      entryPoint("java", javaOpts, "-jar", artifactTargetPath)
    } else {
      val javaOpts = s"-Xmx1024m -XX:+UseG1GC -DseedHostToConnect=${System.getenv("SEED_NAME")} -DseedPort=${System.getenv("AKKA_PORT")}"
      entryPoint("java", javaOpts, "-jar", artifactTargetPath)
    }

    //"-Xmx1256M", "-XX:MaxMetaspaceSize=512m", "-XX:+HeapDumpOnOutOfMemoryError",
  }
}

//#JAVA_OPTS: "-Xmx1024m -XX:+UseG1GC -DseedHost=${SEED_NAME} -DseedPort=${AKKA_PORT} -DhttpPort=${HTTP_PORT} -Djava.rmi.server.hostname=${HOST} -Dcom.sun.management.jmxremote.port=${SEED_JMX_PORT} -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=${SEED_JMX_PORT} -Dcom.sun.management.jmxremote=true"
//#JAVA_OPTS: "-Xmx1024m -XX:+UseG1GC -DseedHostToConnect=${SEED_NAME} -DseedPort=${AKKA_PORT}"<commit_msg>add extra config<commit_after>import _root_.sbtdocker.DockerPlugin.autoImport._
import sbt._
import sbtdocker.ImageName

val scalaV = "2.11.8"
val Akka = "2.4.11"

val Version = "0.2"

name := "docker-cluster"
version := Version
scalacOptions in(Compile, console) := Seq("-feature", "-Xfatal-warnings", "-deprecation", "-unchecked")
scalaVersion := scalaV

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % Akka,
  "com.typesafe.akka" %% "akka-cluster" % Akka,
  "com.typesafe.akka" %% "akka-http-experimental" % Akka,
  "com.typesafe.akka" %% "akka-cluster-metrics" % Akka,
  "com.typesafe.akka" %% "akka-stream" % Akka,
  "com.typesafe.akka" %% "akka-slf4j" % Akka,
  "io.spray" %% "spray-json" % "1.3.2",
  "ch.qos.logback" % "logback-classic" % "1.1.2",
  "com.typesafe.akka" %% "akka-stream-kafka" % "0.13"
)

enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging)

mainClass in assembly := Some("demo.Application")

assemblyJarName in assembly := s"${name.value}-${version.value}.jar"

// Resolve duplicates for Sbt Assembly
assemblyMergeStrategy in assembly := {
  case PathList(xs @ _*) if xs.last == "io.netty.versions.properties" => MergeStrategy.rename
  case other => (assemblyMergeStrategy in assembly).value(other)
}

imageNames in docker := Seq(ImageName(namespace = Some("haghard"), repository = name.value, tag = Some(version.value)))

buildOptions in docker := BuildOptions(cache = false,
  removeIntermediateContainers = BuildOptions.Remove.Always,
  pullBaseImage = BuildOptions.Pull.Always)

dockerfile in docker := {
  val baseDir = baseDirectory.value
  val artifact: File = assembly.value

  val imageAppBaseDir = "/app"
  val configDir = "conf"

  val artifactTargetPath = s"$imageAppBaseDir/${artifact.name}"

  val seedConfigSrc = baseDir / "src" / "main" / "resources" / "seed-node.conf"
  val workerConfigSrc = baseDir / "src" / "main" / "resources" / "worker-node.conf"


  val seedConfigTarget = s"${imageAppBaseDir}/${configDir}/seed-node.conf"
  val workerConfigTarget = s"${imageAppBaseDir}/${configDir}/worker-node.conf"

  new sbtdocker.mutable.Dockerfile {
    from("openjdk:8-jre")
    maintainer("haghard")

    env("VERSION", Version)
    workDir(imageAppBaseDir)
    runRaw("ls -la")

    copy(artifact, artifactTargetPath)
    copy(seedConfigSrc, seedConfigTarget)
    copy(workerConfigSrc, workerConfigTarget)

    if (System.getenv("node.type") == "seed") {
      //val javaOpts = s"-Xmx1024m -XX:+UseG1GC -DseedHost=${System.getenv("SEED_NAME")} -DseedPort=${System.getenv("AKKA_PORT")} -DhttpPort=${System.getenv("HTTP_PORT")}"
      entryPoint("java", s"-DseedHost=${System.getenv("SEED_NAME")}", s"-DseedPort=${System.getenv("AKKA_PORT")}", s"-DhttpPort=${System.getenv("HTTP_PORT")}", "-jar", artifactTargetPath)
    } else {
      //val javaOpts = s"-Xmx1024m -XX:+UseG1GC -DseedHostToConnect=${System.getenv("SEED_NAME")} -DseedPort=${System.getenv("AKKA_PORT")}"
      entryPoint("java", s"-DseedHostToConnect=${System.getenv("SEED_NAME")}", s"-DseedPort=${System.getenv("AKKA_PORT")}",  "-jar", artifactTargetPath)
    }

    //"-Xmx1256M", "-XX:MaxMetaspaceSize=512m", "-XX:+HeapDumpOnOutOfMemoryError",
  }
}

//#JAVA_OPTS: "-Xmx1024m -XX:+UseG1GC -DseedHost=${SEED_NAME} -DseedPort=${AKKA_PORT} -DhttpPort=${HTTP_PORT} -Djava.rmi.server.hostname=${HOST} -Dcom.sun.management.jmxremote.port=${SEED_JMX_PORT} -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=${SEED_JMX_PORT} -Dcom.sun.management.jmxremote=true"
//#JAVA_OPTS: "-Xmx1024m -XX:+UseG1GC -DseedHostToConnect=${SEED_NAME} -DseedPort=${AKKA_PORT}"
{'fraction_non_alphanumeric': 0.17180555555555554, 'fraction_numerical': 0.013333333333333334, 'mean_word_length': 4.9858686616791354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '586782', 'n_tokens_mistral': 2767, 'n_tokens_neox': 2619, 'n_words': 412}