Simply running Pkg.instantiate
in your project should do the trick. I.e something like
COPY .... # copy the sources from your project into the Docker image
RUN julia --project="/path/to/my/project" \
-e "import Pkg; Pkg.instantiate()"
I’m less sure about this one. Perhaps you could copy the Project.toml
file from your project (and perhaps also the Manifest.toml
if you version it) to a temporary directory in the Docker image in an earlier stage, and Pkg.instantiate
it at that time. This way, Docker should cache the results from this stage (including all precompiled packages) and when you later instantiate your real project, Julia/Pkg should find most of the dependencies already precompiled (provided their versions didn’t change inbetween).