-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Entrypoint does not consider mainClass option (and resulted script name) #1335
Comments
Thanks @MihaiAnei for the detailed issue report 😃 The entrypoint is build from the If you have multiple scripts then there are two configuration options described in the multiple start scripts documentation. Can you post the error message from the docker image? A small build setup reproducing this error would be perfect too 😄 |
Hey @muuki88,
Those have exactly the name of the two main classes I have in the project.
as you can see the entrypoint is pointing to the values of I think a simple project with 2 main classes one of which is used in build.sbt and then running docker:publishLocal would do the trick. I can try to provide an example project if that helps you better :) |
Thanks for the feedback 😃 Can you post the output of $ sbt "inspect dockerEntrypoint" "inspect tree dockerEntrypoint" Somewhere the |
And yes. Two modules will do the trick 👍 |
Here is an example reproducing it: https://github.com/MihaiAnei/sbt-native-packager-1335
Above command's output for it. So it's either the script name that needs to be fixed or the entrypoint value?! |
Thanks for the test project. I'll take a look tomorrow. From a first glance this could be an issue with the AshScriptPlugin. You could try without the AshScriptPlugin until I take a look. |
Thanks for looking into this!
but still the same :( |
Hi @MihaiAnei So I checked out the project and called $ sbt docker:stage and opened the docker file in
How does your Dockerfile look like? How did you call the |
Well, that's the problem
does not exist in
none with that name in entry point. Try a publish local and a |
There is also a commented out workaround in |
Thanks for your patience @MihaiAnei 😅 Of course that's the issue 🤦 I found the root cause. It's, as quite a few times, a scoping issue. So the fix ist // too narrow scope
Comile / run / mainClass := Some("...")
// just about right scope
Compile / mainClass := Some("....") the The default behaviour, generating a script per class, doesn't work very well with the docker plugin. However I'm fine with that as a docker image ideally as one entry point. IMHO that's the point of having containers 😜 If you have multiple main classes, then setting the "default" one should be fine. Thanks again for your help 😗 |
Thanks for your help! |
Expected behaviour
I have a project with multiple main classes and as state here: https://www.scala-sbt.org/sbt-native-packager/archetypes/java_app/index.html#usage I use
The scripts in bin result with
boot
name which I think is to be expected.Building the docker image for the project I expect the image to start properly.
Actual behaviour
The Entrypoint in the image is wrong, using project name and not considering the given
mainClass
option.From docker inspect
Information
Plugin version: 1.7.0
SBT: 1.3.10
Built on Linux
Related options:
The text was updated successfully, but these errors were encountered: