Fork me on GitHub
#tools-build
<
2023-02-03
>
Ben Lieberman00:02:48

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?

Ben Lieberman00:02:44

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

hiredman00:02:12

there is no "official" clojure docker

hiredman00:02:47

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

hiredman00:02:53

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

Ben Lieberman00:02:58

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

hiredman00:02:41

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

hiredman00:02:47

sounds like that is what you are getting

Ben Lieberman00:02:14

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 :man-shrugging::skin-tone-2:

seancorfield00:02:55

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.

seancorfield00:02:14

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

seancorfield00:02:27

☝️:skin-tone-2: That help @U03QBKTVA0N?

seancorfield00:02:37

(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)

Ben Lieberman00:02:50

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

Ben Lieberman00:02:12

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

Ben Lieberman00:02:16

But docker run fails

seancorfield00:02:14

(~/.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"

seancorfield00:02:46

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

seancorfield00:02:23

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

Ben Lieberman00:02:18

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

practicalli-johnny11:02:00

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-johnny12:02:01

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