Fork me on GitHub
#leiningen
<
2020-06-23
>
teodorlu09:06:27

Hey! I'm using https://github.com/weavejester/lein-ring uberjar to build my server, using Docker. I'm able to cache some dependencies by calling lein deps before touching my project files. Is there a way to do a call similar to lein deps so that lein ring can cache the dependencies it adds before my own code busts the Docker cache?

teodorlu09:06:22

Cross posted to #ring .

noisesmith14:06:39

what about lein with-profile +ring deps - that should calculate all the lein-ring classpath before running deps

teodorlu15:06:59

Thanks for the suggestion! Running lein with-profile +ring deps doesn't seem to include all the dependencies, though.

Sending build context to Docker daemon  156.4MB
Step 1/8 : FROM clojure:openjdk-11-lein
 ---> ba3af885faf6
Step 2/8 : WORKDIR /app
 ---> Using cache
 ---> 09f838d2f393
Step 3/8 : ADD project.clj ./
 ---> d60445fb9b66
Step 4/8 : RUN lein with-profile +ring deps
 ---> Running in 678edcd00a2b
Retrieving lein-ring/lein-ring/0.12.5/lein-ring-0.12.5.pom from clojars
Retrieving org/clojure/core.unify/0.5.7/core.unify-0.5.7.pom from central
Retrieving org/clojure/pom.contrib/0.1.2/pom.contrib-0.1.2.pom from central
Retrieving org/sonatype/oss/oss-parent/7/oss-parent-7.pom from central
...
Retrieving ring/ring-mock/0.4.0/ring-mock-0.4.0.jar from clojars
Retrieving ring/ring-defaults/0.3.2/ring-defaults-0.3.2.jar from clojars
Removing intermediate container 678edcd00a2b
 ---> 139216aadc67
Step 5/8 : COPY src/ ./src/
 ---> a184583a5fa8
Step 6/8 : COPY resources/ ./resources/
 ---> eae8c20394fe
Step 7/8 : RUN lein ring uberjar
 ---> Running in 04f1250852ab
Retrieving ring-server/ring-server/0.5.0/ring-server-0.5.0.pom from clojars
Retrieving ring/ring/1.3.2/ring-1.3.2.pom from clojars
Retrieving ring/ring-core/1.3.2/ring-core-1.3.2.pom from clojars
...

manas_marthi12:06:35

Hey, did anyone try comparing repl start up time with hotspot jvm vs openj9 jvm?

jumar18:06:08

Do you have Openj9 installed? do you observe/expect a different startup time?

manas_marthi13:06:10

Openj9 claims faster startup. Not sure how to measure it for clojure

jumar13:06:10

as a quick and primitive way you can try:

time clj -e '(print "hello")'