Skip to content

Speeding up alpine build #693

Description

@LaurentGoderre

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.

Activity

  1. LaurentGoderre commented on Apr 13, 2018

    @LaurentGoderre
    MemberAuthor
  2. chorrell commented on Apr 18, 2018

    @chorrell
    Contributor

    I've been wondering if we could use ccache in the builds of alpine:

    https://docs.travis-ci.com/user/caching/#ccache-cache

  3. LaurentGoderre commented on Apr 18, 2018

    @LaurentGoderre
    MemberAuthor

    What does that do?

  4. LaurentGoderre commented on Apr 18, 2018

    @LaurentGoderre
    MemberAuthor

    Ooooh! Promising!!

  5. chorrell commented on Apr 18, 2018

    @chorrell
    Contributor

    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

  6. LaurentGoderre commented on Apr 18, 2018

    @LaurentGoderre
    MemberAuthor

    Perfect. Let's re-open the issue and I will investigate.

  7. chorrell commented on Apr 18, 2018

    @chorrell
    Contributor

    Cool.

  8. LaurentGoderre commented on Apr 19, 2018

    @LaurentGoderre
    MemberAuthor

    @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.

  9. LaurentGoderre commented on Apr 19, 2018

    @LaurentGoderre
    MemberAuthor

    Here's what I have so far: LaurentGoderre@a30a21a

  10. chorrell commented on Apr 19, 2018

    @chorrell
    Contributor

    Interesting! That's a pretty significant improvement

    Yeah, multi-stage would be really helpful here.

  11. LaurentGoderre commented on Apr 19, 2018

    @LaurentGoderre
    MemberAuthor

    @chorrell here is the multi-stage build: LaurentGoderre@d9a988e

  12. LaurentGoderre commented on Apr 19, 2018

    @LaurentGoderre
    MemberAuthor

    So basically now I have to figure out how to extract the cache from the first stage.

  13. chorrell commented on Apr 20, 2018

    @chorrell
    Contributor

    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.

  14. chorrell commented on Apr 20, 2018

    @chorrell
    Contributor

    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...

  15. tianon commented on Apr 20, 2018

    @tianon
    Contributor

    Regarding multi-stage, see also docker-library/official-images#3383.

  16. LaurentGoderre commented on Apr 24, 2018

    @LaurentGoderre
    MemberAuthor

    alpinecache

  17. chorrell commented on Apr 24, 2018

    @chorrell
    Contributor

    NICE

  18. LaurentGoderre commented on Apr 24, 2018

    @LaurentGoderre
    MemberAuthor
  19. LaurentGoderre commented on Apr 24, 2018

    @LaurentGoderre
    MemberAuthor

    There is still an issue where the detection of the build image sometimes fail.

  20. LaurentGoderre commented on Apr 24, 2018

    @LaurentGoderre
    MemberAuthor

    alpinecache2

  21. PeterDaveHello commented on Nov 21, 2018

    @PeterDaveHello
    Member

    Should be done in #918

  22. PeterDaveHello commented on Feb 15, 2019

    @PeterDaveHello
    Member

    That change was reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions