Why Scala does not have an official docker image
I'm getting started with Scala, and really surprise me that a language like Scala does not have an official Docker image on docker hub, and I just wondering... why? Is an organization political/decision or any architecture problem?
EDIT: Thanks for all the responses, as I said I am just getting started and I'm just looking the available tooling, so you helped me a lot :)
Posted Nov 18, 2020, 6:57 PM UTC · edited
What exactly do you expect on an official docker image of Scala to have?
I would like to echo and expand upon this. In general I see four use-cases which would require images. Let me first list all of them and then collect the things each of them would need to contain.
Now before we get started listing the requirements for each image there is one thing all of them need which is some version of Java (JRE only for d, JDK for a, b, c). And here you already have tons of alternatives to choose from. But let's get to the specific images now.
(a) For this you would additionally require your build tool of choice and possibly the Scala version of your choice installed. I say possible because e.g. SBT will take care of this for you so you only need SBT. Additionally depending on your IDE you may or may not require some additional tools installed that let eh IDE help do it's thing (e.g. code highlighting, linting, ...). And what one should also not discard is that you may want Docker to run in your Docker image when your tests utilize the awesome Testcontainers library (https://www.testcontainers.org/).
(b) Equivalent to (a) in terms of requirements.
(c) This one is almost equivalent to (a) with the exception of the IDE specific tools. These can be removed here.
(d) Finally for this one you only need some version of JRE. One thing to note here is that when using SBT to build your application you can utilize the plugin sbt-native-packager (https://sbt-native-packager.readthedocs.io/en/stable/formats/docker.html) to build an image with your application in it for you. I find this incredibly convenient personally as otherwise you would have to define a lot of what I consider to be messy things yourself. I.e. you would need to copy the JAR files your build generated, copy them to a destination in your image and finally configure the entrypoint of the image to be your JAR to be executed. One implication of this however is that (c) again requires Docker (so Docker-in/on-Docker needs to be enabled).
In conclusion I think one can see that different use-cases require different images and even within these use-cases there are many options to be chosen, like the Java version, the build tool and whether or not one wants to use Docker-in/on-Docker. Therefore I think it's not super useful to have some official image which will always fall short for lot's of combinations.
Just for the curious here is an image I once created for running in a CI pipeline (outdated by now):