Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building drafter is painfully slow. #788

Closed
bunchesofdonald opened this issue Sep 24, 2020 · 3 comments
Closed

Building drafter is painfully slow. #788

bunchesofdonald opened this issue Sep 24, 2020 · 3 comments

Comments

@bunchesofdonald
Copy link
Contributor

I'm working on building a python library that uses Drafter to parse API Blueprints, as such all I really care about is libdrafter itself. I'm using docker for developing / testing and every time I rebuild the container it takes 10+ minutes to build drafter itself. Is there a way to speed up the build? Is there a way to build just the lib portion that I need?

@bunchesofdonald
Copy link
Contributor Author

These are the steps I'm using to do the build:

RUN apt-get update && apt-get install -y build-essential cmake curl && rm -rf /var/lib/apt/lists/*
RUN curl -OL https://github.com/apiaryio/drafter/releases/download/v5.0.0/drafter-5.0.0.tar.gz
RUN tar xf drafter-5.0.0.tar.gz && mkdir -p drafter-5.0.0/build && cd drafter-5.0.0/build && cmake .. && make && make install

@kylef
Copy link
Member

kylef commented Sep 28, 2020

I rebuild the container it takes 10+ minutes to build drafter itself

Once built, providing the version of Drafter isn't changed you should be able to utilise docker layer caching so that it will never need to rebuilt the Drafter layers of the image. You may also create a separate base image or multi-staged build.

Is there a way to speed up the build? Is there a way to build just the lib portion that I need?

You can utilise the option --jobs (or -j) to make to instruct it that it may build various parts in parallel to speed up the build.

Is there a way to build just the lib portion that I need?

Changing make to make drafter to omit building the tests. There is also a drafter-lib target, however install will fail as the drafter binary won't exist (that shouldn't take very long to build thought). https://hub.docker.com/r/apiaryio/drafter/dockerfile contains an example.

I'm working on building a python library that uses Drafter to parse API Blueprints

If you're not already aware, there's a Python library Draughtsman offering bindings to libdrafter.

@bunchesofdonald
Copy link
Contributor Author

I'm aware of layer caching, but we use ephemeral jenkins nodes and Docker caching isn't always available, and I build a lot of docker images and have to routinely prune my images to keep the down the size.

That's all super helpful, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants