Posted: Leiningen: Split an uberjar into dependencies.jar and app.jar (to optimize Docker layers and AWS Lambda functions)

I want to split my application uberjar into a separate JAR with only the dependencies and a JAR with only the application code so that I can upload them as separate “layers” and thus leverage layer caching. While my code changes frequently and is tiny, the dependencies change rarely and are much bigger. If I can add them as a separate Docker layer or AWS Lambda layer then this can be cached on the server and reused when I upload a new version - saving time, bandwidth, and money.

Continue reading…

1 Like

That’s great… I will give it a try.

Another alternative I found is Google’s Jib, which you can use for clojure deps.edn projects with juxt’s pack.alpha.
A plus: it doesn’t use the Docker daemon.

1 Like