This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-19
Channels
- # adventofcode (1)
- # announcements (3)
- # babashka (60)
- # beginners (60)
- # calva (5)
- # clj-commons (17)
- # clj-kondo (33)
- # clj-on-windows (1)
- # clojure (40)
- # clojure-austin (3)
- # clojure-europe (19)
- # clojure-gamedev (25)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sweden (4)
- # clojure-uk (2)
- # clojurescript (27)
- # conjure (1)
- # core-async (1)
- # core-typed (7)
- # cursive (5)
- # datomic (35)
- # events (1)
- # fulcro (35)
- # integrant (7)
- # introduce-yourself (2)
- # kaocha (5)
- # leiningen (2)
- # lsp (26)
- # malli (13)
- # nbb (99)
- # off-topic (15)
- # pathom (12)
- # pedestal (5)
- # polylith (8)
- # portal (4)
- # rdf (19)
- # reagent (8)
- # reitit (5)
- # releases (2)
- # remote-jobs (2)
- # rewrite-clj (1)
- # shadow-cljs (94)
- # testing (2)
- # timbre (2)
- # tools-deps (16)
I’d like to do clj -P
inside a dockerfile/docker build stage to cache all the maven dependencies, then clj -M
at the entrypoint, but i’m concerned clj -M
will still try to fetch dependencies over the network and error out and for various reasons I can only do network calls in docker build
. is my concern warranted (?), if so is there a fix (other than producing uberjars).
You might be able to use the -Scp
option to pass it a pre-built classpath so it just uses what is specified without trying to download anything.
Yeah, you could run bare java -cp
with the saved result of -Spath
. But clj
itself has a -Scp
option in case you need to run Clojure tools without recomputing/fetching anything.
(you mentioned clj -M
so I figured you were trying to do something specific with :main-opts
)
clj won't even run the process that has access to the code to fetch deps unless it hasn't computed the classpath for your deps.edn yet
so that was the basis of my concern, you’re saying it won’t do a network call if deps.edn has the same content
Depends what you mean by same content, if the bytes hash the same (so whitespace and comments, etc count)
I was playing with something like that in the past. And I think there is no guaranty that clj
does not "try" to access the network. The -P is more for "reducing download time" then to guarantee that no network call occur, I believe.
Maybe worth to check with clojure.core team.
There are a few cases in which tools.deps will always hit the network, regardless of what is cached. The one we've ran into most often is https://clojure.atlassian.net/browse/TDEPS-223. That particular issue can be worked around by making all the git deps use full hashes and no tags.
Offline builds are not really a design goal I think, so you need a few tricks to make them work. Alternatively you can run a pre-populated git + maven caching proxy within your sandboxed build, but that's a bit more involved.