[ad_1]
I have a multi module SBT project that I’m using to build a Docker image out of. There is one module that depends on all the other modules and I’m actually trying to build the Docker image for this module. Here is a snippet from my build.sbt
lazy val impute = (project in file(MODULE_NAME_IMPUTE)).dependsOn(core% "compile->compile;test->test", config)
.settings(
commonSettings,
enablingCoverageSettings,
name := MODULE_NAME_IMPUTE,
description := "Impute the training data"
)
.enablePlugins(JavaAppPackaging, DockerPlugin)
lazy val split = (project in file(MODULE_NAME_SPLIT)).dependsOn(core% "compile->compile;test->test", config)
.settings(
commonSettings,
enablingCoverageSettings,
dockerSettings("split"),
name := MODULE_NAME_SPLIT,
description := "Split the dataset into train and test"
)
.enablePlugins(JavaAppPackaging, DockerPlugin)
lazy val run = (project in file(MODULE_NAME_RUN)).dependsOn(core % "compile->compile;test->test", config, cleanse, encode, feature, impute, split)
.settings(
commonSettings,
dockerSettings("run"),
enablingCoverageSettings,
name := MODULE_NAME_RUN,
description := "To run the whole setup as a pipeline locally"
)
.enablePlugins(JavaAppPackaging, DockerPlugin)
As you can see, the run module depends on all the other modules and I’m actually trying to build the Docker image for the run module for which I used the following command:
sbt run/docker:publishLocal
This works fine and the Docker image is also built, but when I inspect my Docker image, especially on the ENTRYPOINT, I get to see the following:
"Entrypoint": [
"/opt/docker/bin/run"
],
But instead, I would have expected to see something like this:
"Entrypoint": [
"java",
"-cp",
"com.mypackage.housingml.run.Main"
],
Is there anything else that I’m missing? Here is my dockerSettings() function from my build.sbt:
def dockerSettings(name: String) = {
Seq(
// Always use latest tag
dockerUpdateLatest := true,
maintainer := s"$projectMaintainer",
// https://hub.docker.com/r/adoptopenjdk/openjdk13
// Remember to use AshScriptPlugin if you are using an alpine based image
dockerBaseImage := "adoptopenjdk/openjdk13:alpine-slim",
// If you want to publish to a remote docker repository, uncomment the following:
//dockerRepository := Some("remote-docker-hostname"),
Docker / packageName := s"joesan/$projectName-$name",
// If we're running in a docker container, then export logging volume.
Docker / defaultLinuxLogsLocation := "/opt/docker/logs",
dockerExposedVolumes := Seq((Docker / defaultLinuxLogsLocation).value),
dockerEnvVars := Map(
"LOG_DIR" -> (Docker / defaultLinuxLogsLocation).value,
)
)
}
[ad_2]