Skip to content

Instantly share code, notes, and snippets.

@n2o
Last active August 8, 2022 09:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n2o/bbaf24908c2d7137d756e911b8c84eda to your computer and use it in GitHub Desktop.
Save n2o/bbaf24908c2d7137d756e911b8c84eda to your computer and use it in GitHub Desktop.
Caching Clojure tools.deps Dependencies when building Docker Images

To cache the layer containing the dependencies from your Clojure project, you can execute a command without starting a REPL. This downloads all common dependencies, which are then be cached.

For example:

FROM clojure:openjdk-14-tools-deps-alpine

# Cache and install Clojure dependencies
COPY deps.edn .
RUN clojure -Sdeps '{:mvn/local-repo "./.m2/repository"}' -e "(prn \"Downloading deps\")"

COPY . .

# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment