sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.6k stars 441 forks source link

Bad root server path after docker containerization. #1366

Closed Asmau1234 closed 4 years ago

Asmau1234 commented 4 years ago

Expected behaviour

"sbt docker:publishLocal generates a dockerfile without CMD for heroku deployment."

Actual behaviour

when I add

dockerCommands := dockerCommands.value.map {
  case ExecCmd("CMD", _ @ _*) =>
    ExecCmd("CMD", "/opt/docker/bin/myapp")
  case other =>
    other
}

to my build.sbt i can add the CMD command but when i build the app and gives me an error.

"sbt docker:publishLocal fails with: Bad root server path: /opt/docker/bin/myapp"

Information

I am using

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.5")`

sbt.version=1.0.4

I have tried everything but i still can't run the app locally. when i remove the added CMD command tho, it works locally but i cant deploy to heroku.

muuki88 commented 4 years ago

Thanks @Asmau1234 for the detailed issue.

The main problem is that it doesn't work on Heroku, right? What are the error messages when you try to start the image on heroku and what are you trying to solve with the CMD change?

The build fails as the script doesn't exist at this location.

Asmau1234 commented 4 years ago

@muuki88 so i found a solution to it after many hours. After i changed my entry point tho this dockerEntrypoint := Seq("") in my build.sbt it worked out fine and i was able to start the app locally. I don't understand why docker couldn't read my default entrypoint eventho when in the CMD command i call the executable file which is the same path as the default entry point.

muuki88 commented 4 years ago

Thanks for the update. So this is problem on how heroku starts docker images?

I remember that there's some sort of config file for heroku that tells it how to start stuff. Isn't that the case for docker as well?