tools-build

liebs 2023-02-03T00:05:48.195709Z

I don't really know anything about Docker but I've built an image and I have the run cmd set to clojure -Sdeps '{:deps {my/jar ...}}' but it returns this error "Invalid option -Sdeps". I'm using the official Clojure image from Docker Hub so I would think all the normal CLI options would work?

practicalli-johnny 2023-02-03T11:20:00.321759Z

The Official Clojure docker image is excellent (very surprised at the negative comments in this thread) It supports the latest released version of Clojure CLI and Leiningen (even boot) I used the Official Clojure docker image in my last two commercial projects without issue. I use a multi-stage Docker config, one stage to build, one to run https://practical.li/blog/posts/build-and-run-clojure-with-multistage-dockerfile/ • I should update this article for tools.build, but it's just changing one line, the command that builds to uberjar

practicalli-johnny 2023-02-03T12:33:01.018019Z

FYI there is a #docker channel if you don't get help here

liebs 2023-02-03T00:06:44.132259Z

Also not sure if this is the best channel for this 😬

2023-02-03T00:13:12.451479Z

there is no "official" clojure docker

2023-02-03T00:13:47.896459Z

as in there is none thatis "blessed" by the clojure core team (I don't think)

2023-02-03T00:14:53.405069Z

there is a docker image that http://docker.com has decided is "official" and who knows what is in it, and who knows if anyone that has written a clojure program was involved in creating it

liebs 2023-02-03T00:17:58.748269Z

noted, I guess I should say that is the one that is marked "Docker official image" https://hub.docker.com/_/clojure

2023-02-03T00:18:41.441699Z

debian at one point packaged its own shell scripts with clojure, so if you apt-get installed clojure you would get a shell script called clojure that would launch a clojure repl and not much else

2023-02-03T00:18:47.891809Z

sounds like that is what you are getting

liebs 2023-02-03T00:20:14.735799Z

hm, that sounds promising, because I don't have any explicit "download Clojure" commands in my Dockerfile (should I?). I figured that the image would be doing that for me 🤷🏻‍♂️

seancorfield 2023-02-03T00:40:55.123379Z

Oh, it probably has only lein by default (and some ancient default version of clojure?). You need one of the tools-deps from that page.

seancorfield 2023-02-03T00:41:14.371179Z

e.g., clojure:temurin-19-tools-deps

seancorfield 2023-02-03T00:42:27.859519Z

point_up::skin-tone-2 That help @bhlieberman93?

seancorfield 2023-02-03T00:43:37.846519Z

(we use that image at work for our BitBucket CI but I've never paid attention to the installed CLI version because we have our own version, vendored into our repo, and that is what gets used for our CI pipeline)

liebs 2023-02-03T00:45:50.581229Z

I was reading these docs and others, and I tried doing FROM clojure:tools-deps and other variants thereof but it did not make a difference

liebs 2023-02-03T00:46:12.584189Z

Build succeeds, I watch my deps and the tools.build deps get pulled

liebs 2023-02-03T00:46:16.171969Z

But docker run fails

seancorfield 2023-02-03T00:48:14.618719Z

(~/.clojure)-(!2179)-> docker run clojure:temurin-19-tools-deps --version
Clojure CLI version 1.11.1.1165

Thu Feb 02 16:47:54
(~/.clojure)-(!2180)-> docker run clojure:temurin-19-tools-deps -M -e "(clojure-version)"
"1.11.1"

seancorfield 2023-02-03T00:48:46.190579Z

(but surprised I didn't get 1.11.1.1208 there but it's still a recent version)

seancorfield 2023-02-03T00:50:23.209989Z

Oh, I had that version locally...

(~/.clojure)-(!2181)-> docker run clojure:temurin-19-tools-deps-1.11.1.1208 --version
Unable to find image 'clojure:temurin-19-tools-deps-1.11.1.1208' locally
temurin-19-tools-deps-1.11.1.1208: Pulling from library/clojure
10ac4908093d: Pull complete
...
da31c64a0382: Pull complete
Digest: sha256:88651758a515994b9be316e7a32a2f40db7551f8f0b4949628c9cd2752578869
Status: Downloaded newer image for clojure:temurin-19-tools-deps-1.11.1.1208
Clojure CLI version 1.11.1.1208

liebs 2023-02-03T00:55:18.898579Z

I'll have to consult this more closely when I'm back home. Thanks @seancorfield