3 ms·
Split any "download dependency" steps from the rest of the code copy. I've got an example with benchmarks here: https://github.com/aspnet/aspnet-docker/issues
by alexc05 11y ago
Split any "download dependency" steps from the rest of the code copy.
I've got an example with benchmarks here: https://github.com/aspnet/aspnet-docker/issues/123 https://github.com/aspnet/aspnet-docker/issues/123
old-speed
Start: 06:03:13.313
Finish: 06:06:40.640
new-speed
Start: 06:00:36:036
Finish: 06:00:45:045
So essentially you copy the package.json or project.json, run dnu restore/ NPM install then copy the rest of the project.
COPY ./project.json /app/project.json
WORKDIR /app
RUN ["dnu", "restore"]
COPY . /app
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "web"]
What this means is that if dependencies don't change the step where you downloaded them will be a cached binary.
It makes iteration a LOT faster.
- oilbeater 11y agoGreat advice,thanks!