I have an sbt project producing my artifact xyz
.
I would like to put it along with all its dependencies in the docker container so it can be used using
coursier launch --mode offline xyz
The important part is that preparation should take use of local cursier cache from host.
I tried
- executing
sbt publishLocal
, - then resolving my artifact dependencies (
cursier resolve xyz
), - then preparing to directories -
local
&cache
- by copying resolved artifact into them - then copying those directories into docker container (as coursier cache and ivy local respectively).
This didn't work because coursier doesn't list .pom
and .xml
files in its output. I tried copying whole directories (abc/1.0.0
instead of abc/1.0.0/some.jar
) but AFAIK there is no reliable way to know how many folders up one has to go because maven and ivy have different dir structures.
while my usecase is not quite identical to yours -- I figure I'd write up my findings and maybe my solution works for you as well!
here's my sample dockerfile, I used this to install
scalafmt
in an offline-compatible waythe key to offline execution for me was to use
cs fetch
and setCOURSIER_CACHE
here's the offline execution succeeding: