I'm trying to use clj-kondo with the docker file. I can't seem to get it to use the cache directory. I'm running this command:
sudo docker run -v $PWD/src:/src -v $HOME/.m2:$HOME/.m2 -v $HOME/.clj-kondo:$PWD/.clj-kondo borkdude/clj-kondo clj-kondo --cache-dir=$HOME/.clj-kondo --lint "$(lein classpath)"
The way I'm reading the project setup section, I'm expecting to see it generate files in the project's .clj-kondo directory but it's not creating anything in there. Am I running the command incorrectly or have I misunderstood?The way you mount files into the docker container looks a bit inconsistent maybe
-v $HOME/.clj-kondo:$PWD/.clj-kondo
that doesn't look right
should probably be -v $PWD/.clj-kondo:/.clj-kondo
or something?
since you also mount: -v $PWD/src:/src
also the cache-dir looks weird.
Note that $HOME
gets expanded in your shell before it goes into docker, at least I think so
Might be best to just bash into the container and look around
makes sense - I'll try and attach to the container and poke around
I would think something like
docker run -v $HOME:$HOME borkdude/clj-kondo clj-kondo --cache-dir=$PWD/.clj-kondo --lint "$(lein classpath)"
should work as long as PWD is somewhere in HOME. Since lein classpath
evaluates outside of docker, that classpath string has to end up making sense to clj-kondo running inside docker. I think you might be able to add -w $PWD
to set the working dir, and then not have to set --cache-dir
since .clj-kondo is the default. So
docker run -v $HOME:$HOME -w $PWD borkdude/clj-kondo clj-kondo --lint "$(lein classpath)"
When I ran this on my project, I found that it gave me the same results as if I ran without docker (including running the hooks in my local .clj-kondo)@slimslenderslacks thank-you! that worked, wrote to my cache dir. It makes sense, I've got it checking my source properly now I believe.