Repository navigation
Speeding up alpine build #693
Description
Activity
Here's the build that shows it: https://travis-ci.org/LaurentGoderre/test/builds/366177813
I've been wondering if we could use ccache in the builds of alpine:
What does that do?
Ooooh! Promising!!
Yeah, I'm not quite sure how it works in Travis-CI but it could help speed up the builds. I've experimented with something similar (sccache) for other projects and in some cases it was able to cut the build time half. I think that highly depends on the project and code though, but worth exploring I think.
I'm pretty sure that the Node.js build team uses it in their Jenkins setup. They use it for building OpenSSL: https://github.com/nodejs/node/blob/eec659c138f3afcd51a25cd8b197d715a47baa65/deps/openssl/openssl/.travis.yml
Perfect. Let's re-open the issue and I will investigate.
Cool.
@chorrell not having build time volume mount really complicates this! I have to find a way to extract the cache from the image but also delete it from the image since we don't want it in there. Perhaps I have to start experimenting with multi-stage.
However, it REALLY works! compile time went from 30 minutes to 5.
Here's what I have so far: LaurentGoderre@a30a21a
Interesting! That's a pretty significant improvement
Yeah, multi-stage would be really helpful here.
@chorrell here is the multi-stage build: LaurentGoderre@d9a988e
So basically now I have to figure out how to extract the cache from the first stage.
Something else to consider is sccache: https://github.com/mozilla/sccache
It's ccache with cloud storage. I'm not sure if anyone has got that to work in travis-ci though and I think we'd still want to use multi-stage regardless.
Actually, maybe not. We would have to install/build sscache in the alpine image which would probably be just as slow as the node.js build...
Regarding multi-stage, see also docker-library/official-images#3383.
NICE
And here I isolated the alpine builds: https://travis-ci.org/LaurentGoderre/docker-node/builds/370635694
There is still an issue where the detection of the build image sometimes fail.
Should be done in #918
That change was reverted.


I wanted to share something I looked into to try and speed up the alpine build that ultimately failed. I tried to see if the potential of using multi-stage builds with a pre-built alpine image with all the dependencies would reduce the build time. It turns out that the installing of dependencies only takes 35s so there is not gains to be made here.