0

can someone help with how to add a file system folder into a docker image... e.g. I want to add /opt/app/conf into the docker image at path /opt/docker/conf. A snippet of the build.sbt is as follows:

dockerCommands :=
  dockerCommands.value.flatMap {
    case cmd@Cmd("FROM", ) => List(cmd, Cmd("RUN", "apk add --no-cache bash"))
    case ExecCmd("ENTRYPOINT", args @ *) => Seq(Cmd("ENTRYPOINT", args.mkString(" ")))
    case v => Seq(v)
},
erip
  • 16,374
  • 11
  • 66
  • 121

1 Answers1

0

I'm assuming that you are using native packager. You will need to map the desired files into your docker context. Invoking

mappings in Universal ++= Seq(
  file("/opt/app/conf/<filename>") -> "app/conf/<filename>"
)

will put the given file into your docker context under app/conf.

However, I'd recommend against mapping /opt/app as that requires any machine which builds the image to have the proper path and files. Instead, consider adding the configurations into the src/main/resources path and mapping those over.

mappings in Universal ++= Seq(
  (baseDirectory.value / "src/main/resource/app/conf/<filename>") -> "app/conf/<filename>"
)

I prefer explicitly including files (no directory recursion) but you should be able to use Paths to incorporate recursion.

Shane Perry
  • 980
  • 7
  • 12