docker-clojure icon indicating copy to clipboard operation
docker-clojure copied to clipboard

Question: does it make sense to merge lein and tools.deps images?

Open alexander-yakushev opened this issue 4 months ago • 6 comments

Given that the image size is absolutely dominated by JDK (~300 Mb uncompressed), would it be reasonable to ship both Leiningen (~15 Mb uncompressed) and tools.deps (around the same but also needs Git installed) in the single image, kinda like what is done for latest? There are a couple of projects that use both on CI and such projects could benefit from such a change. Are there any drawbacks apart from increased image size?

alexander-yakushev avatar Apr 19 '24 14:04 alexander-yakushev

Hmm... I could see that making sense; especially if we stop shipping the boot variants soon (which I think we should). The full version tags would get a bit unwieldy... E.g. clojure:temurin-21-lein-2.11.0-tools-deps-1.11.2.1435. But we could also push tags that only specify their lein version or their tools-deps version (but they would all still include both tools) for those who only use one or the other.

What a mess we've got in our tooling these days. Sigh. 😉

What do you think, @Quantisan?

cap10morgan avatar Apr 19 '24 15:04 cap10morgan

Posted it to the #docker channel in Clojurians Slack to see what folks think in there: https://clojurians.slack.com/archives/C0PME9N9X/p1713539776559319

cap10morgan avatar Apr 19 '24 15:04 cap10morgan

But we could also push tags that only specify their lein version or their tools-deps version (but they would all still include both tools) for those who only use one or the other.

I like this idea!

Regarding boot: it makes sense dropping it since the old images will still exists, and whoever keeps using it can always build their own images.

alexander-yakushev avatar Apr 19 '24 15:04 alexander-yakushev

tl;dr; I don't see any problem.

Speaking out loud my initial worry that turns out to be moot. My first concern would be potential conflict for dependencies. But this is about building an image and not using them in the same JDK project. i.e. like most people, I have both tools installed on my machine too. And it's fine. So I guess it's ok in an image too.

For the record, I had a look at the dependencies.

https://github.com/clojure/tools.deps/blob/master/deps.edn

versus

https://github.com/technomancy/leiningen/blob/github/project.clj -> https://github.com/technomancy/leiningen/blob/github/leiningen-core/project.clj -> https://github.com/clj-commons/pomegranate/blob/master/deps.edn

I see these dependency conflicts:

-org.clojure/data.xml: Lein uses version 0.2.0-alpha6, while the Deps project uses version 0.2.0-alpha9 -org.apache.maven/maven-resolver-provider: Lein is on 3.8.7, while Deps is at 3.8.8

  • a bunch of overlaps related to org.apache.maven.resolver/*
  • Deps excludes com.google.guava/guava from org.apache.maven/maven-core, but Lein doesn't manage this dependency

Again, this only matters if you use both in your Clojure project.

Quantisan avatar Apr 22 '24 01:04 Quantisan

Another issue: tools-deps and Leiningen have different CMDs (lein repl and clj) and different entrypoints. If the images are merged into one, then we'll have to settle on a single entrypoint, and that would be compatibility-breaking.

The possible solution is to still have both in all images, but have -lein variants with Leiningen entrypoints and -tools-deps (and default) variants with tools.deps entrypoints.

alexander-yakushev avatar Apr 23 '24 12:04 alexander-yakushev

Another issue: tools-deps and Leiningen have different CMDs (lein repl and clj) and different entrypoints. If the images are merged into one, then we'll have to settle on a single entrypoint, and that would be compatibility-breaking.

The possible solution is to still have both in all images, but have -lein variants with Leiningen entrypoints and -tools-deps (and default) variants with tools.deps entrypoints.

Yeah I think we should vary it based on the tag we're building. And for tags that include both (incl. latest), let's use the tools.deps entrypoint (as the first party option).

cap10morgan avatar Apr 23 '24 15:04 cap10morgan