Fetch and pre-build dub dependencies

Tamas user at dlang.io
Tue Mar 6 18:03:34 UTC 2018


I have a Dockerfile to build a vibe.d project. Docker has a nice 
caching system so it continues building the docker image from the 
step where it's needed when something changes. This is typically 
at the step of adding my source files, then building the binary.

The problem is that fetching and building vibe dependencies takes 
a lot of time every time some source files of mine changes.

I can pre-fetch dub dependencies, although it's a bit cumbersome 
as fetch doesn't load dependencies of the given package.

     RUN dub fetch vibe-d --cache=system
     RUN dub fetch vibe-core --cache=system
     RUN dub fetch eventcore --cache=system
     ....

But there's no easy way to build these dependencies before I add 
my project source files to the docker image. If I could do that 
the docker build process would be tremendously faster, as it 
would be simply skipped automatically by the Docker cache system. 
Currently 99% of the time spent on building the dependencies when 
i am creating a docker image. (I have to use ldc for ARM, which 
is slower.)

Is there an easy way to fetch and prebuild a dub package 
dependencies?

something like "dub fetch-and-build vibe-d --recursive 
--cache=system"



More information about the Digitalmars-d mailing list