### Evolution of a build system

[November 19th, 2019](https://crave.io/2019/11/)
by [Yuvraaj Kelkar](https://crave.io/author/uvatbc/)

#### It was simple in the beginning. Really.

About 10 years ago I started hacking together a cross platform Google Voice client.

I didn’t think too much about my build system at that time — I just followed what I saw others did and used an IDE to develop, debug and test.

When it was time to automate compilation and packaging, I used shell scripts and leveraged the toolchain that was installed along with the IDE.

This was perfectly adequate because I was the only one working on my app and only used two development machines: My laptop and desktop.

Every time there was an update or a new version for the IDE or the toolchain, all I had to do was to remember to install it on both my machines.

When I later added support for more platforms, I had to ensure that both my machines had the same version for all toolchains, otherwise I’d hit some very hard to explain bugs.

Maintaining all these development environments became increasingly stressful — I had started dreading working on my side project just because managing the toolchains felt like tiptoeing through a mine-field.

After suffering this for a while, I created multiple virtual machines, each with the toolchain for at most one or two target platforms.

My editor or IDE would be local to the machine I wanted to code on, but the final build and release would ALWAYS be on the virtual machine that had the right toolchain.

I soon realized that although I had compartmentalized the toolchains, I now had this bunch of VMs which I needed allocate memory and storage… not to mention the additional time I spent keeping the VMs updated.

The runtime requirements were also onerous: My desktop, which I thought was pretty beefy with 8GB RAM and 120GB SSD, could not instantiate more than three VMs at once.

Using my laptop to host the VMs was out of the question.

Lacking an easy way to duplicate my build environment to one or more ephemeral AWS instances, I just assumed this was the best I could do.

It worked and that was all that mattered.

… until the day my desktop’s hard drive crashed and I lost all my VMs.

I’m not an enterprise class user, why would I ever backup my VMs?

After about a week of going through the multiple stages of grief, I finally finished rebuilding all those VMs and setting up backups. While rebuilding the VMs I realized how brittle my entire build and release system had become even though I was using virtual machines, backups and snapshots.

It didn’t matter that my code was all open source: It was impossible for anyone else to compile it.

I had no simple mechanism to duplicate my build environment for anyone else to take a shot at helping me.

I couldn’t rationally expect any random developer to install the toolchain in the exactly the same way that I had in my VMs.

I had painted myself into a corner.

#### Enter Docker

At the start of 2015, I started investigating Docker — primarily to check out what the buzz was all about.

To be completely honest, I didn’t see what the big deal was: Chroot environments were around since the last century (hah!) and at first glance Docker looked like nothing more than just a nice wrapper around a chroot.

The egotistical geek in me almost immediately dismissed Docker with the thought “I could do all that with a tiny perl script”.

Luckily, I am old enough to know not to blindly trust that voice and dug deeper into what Docker was and why people were going googly eyed about it.

I think my first “aha” moment was when I tried [compiling Docker](https://docs.docker.com/opensource/project/software-required/). That was when I was first introduced to docker-ception: Docker uses docker to compile docker.

Here’s what you essentially do to get a new docker binary:

```
sudo apt-get install -y docker.io
git clone
make binaryCopy
```

This is in stark contrast to every other project I had tried compiling: there was no 21-step procedure to set up a development environment before it is possible to compile anything; no anxiety over library versions or compatibility, nothing.

Instead, within 15 minutes of starting, I had the new docker binary, compiled successfully at the first attempt.

I was hooked: I had to find out how Docker did this and how I could use it for myself.

#### Docker is … what exactly?

Docker is a whole lot of things, but to begin with, think of it as a convenient wrapper over a clean execution environment.

Any application depends on libraries or environment variables that it needs at run time to work properly. You can use docker to collect these dependencies into a “docker image” and use an instance of that image to run your application.

From a design and operations point of view, this isn’t a new concept. For example, a lot of applications use virtual machines as execution enviroments. What Docker brought was significant simplicity to the packaging and deployment of that execution environment.

A build toolchain is an excellent use case of an execution environment: its tools are installed at a fixed location, usually identified by environment variable (eg. $PATH), has configuration options stored in files and so on.

This is not to say that Docker is the right choice for every application in the world even though it is a much better alternative for at least build and release.

#### Hammer, meet nail

Creating the image that could build my app was fairly straightforward. To summarize:

1. Identify the dependencies
2. Write a Dockerfile
3. Build the image and optionally push it to the Docker Hub or some registry
4. Instantiate containers to compile the code

Once I established that the container image could compile my app correctly by testing the app, I tried the image out in a few different environments: My laptop, my desktop, a couple of my virtual machines, a newly spawned AWS instance, a friend’s laptop and so on.

Time taken to be able to compile on a new host: About 5 minutes. This was significantly better than the VMs I was using in terms of disk/memory requirements, spin up/spin down time and maintenance cost.

I had achieved what I set out to do.

… so I deleted my VMs. 🙂

_Flawless victory_

#### tl;dr

My build system started its life as an IDE, graduated to build scripts, then to virtual machines and finally ditched VMs for containers.

Disqus Comments

We were unable to load Disqus. If you are a moderator please see our [troubleshooting guide](https://docs.disqus.com/help/83/).

G

Start the discussion…

Comment

###### Log in with

###### or sign up with Disqus  or pick a name

### Disqus is a discussion network

- Don't be a jerk or do anything illegal. Everything is easier that way.

[Read full terms and conditions](https://docs.disqus.com/kb/terms-and-policies/)

This comment platform is hosted by Disqus, Inc. I authorize Disqus and its affiliates to:

- Use, sell, and share my information to enable me to use its comment services and for marketing purposes, including cross-context behavioral advertising, as described in our [Terms of Service](https://help.disqus.com/customer/portal/articles/466260-terms-of-service) and [Privacy Policy](https://disqus.com/privacy-policy), including supplementing that information with other data about me, such as my browsing and location data.
- Contact me or enable others to contact me by email with offers for goods or services
- Process any sensitive personal information that I submit in a comment. See our [Privacy Policy](https://disqus.com/privacy-policy) for more information

Acknowledge I am 18 or older

- [Favorite this discussion](https://disqus.com/embed/comments/?base=default&f=crave-io&t_i=275%20https%3A%2F%2Fwww.crave.io%2F%3Fp%3D275&t_u=https%3A%2F%2Fcrave.io%2Fevolution-of-a-build-system%2F&t_e=Evolution%20of%20a%20build%20system&t_d=Evolution%20of%20a%20build%20system%20%E2%80%93%20Crave.io&t_t=Evolution%20of%20a%20build%20system&s_o=default# "Favorite this discussion")

- ## Discussion Favorited!

Favoriting means this is a discussion worth sharing. It gets shared to your followers' Disqus feeds, and gives the creator kudos!

[Find More Discussions](https://disqus.com/home/?utm_source=disqus_embed&utm_content=recommend_btn)

[Share](https://disqus.com/embed/comments/?base=default&f=crave-io&t_i=275%20https%3A%2F%2Fwww.crave.io%2F%3Fp%3D275&t_u=https%3A%2F%2Fcrave.io%2Fevolution-of-a-build-system%2F&t_e=Evolution%20of%20a%20build%20system&t_d=Evolution%20of%20a%20build%20system%20%E2%80%93%20Crave.io&t_t=Evolution%20of%20a%20build%20system&s_o=default#)

- Tweet this discussion
  - Share this discussion on Facebook
  - Share this discussion via email
  - Copy link to discussion

- [Best](https://disqus.com/embed/comments/?base=default&f=crave-io&t_i=275%20https%3A%2F%2Fwww.crave.io%2F%3Fp%3D275&t_u=https%3A%2F%2Fcrave.io%2Fevolution-of-a-build-system%2F&t_e=Evolution%20of%20a%20build%20system&t_d=Evolution%20of%20a%20build%20system%20%E2%80%93%20Crave.io&t_t=Evolution%20of%20a%20build%20system&s_o=default#)
  - [Newest](https://disqus.com/embed/comments/?base=default&f=crave-io&t_i=275%20https%3A%2F%2Fwww.crave.io%2F%3Fp%3D275&t_u=https%3A%2F%2Fcrave.io%2Fevolution-of-a-build-system%2F&t_e=Evolution%20of%20a%20build%20system&t_d=Evolution%20of%20a%20build%20system%20%E2%80%93%20Crave.io&t_t=Evolution%20of%20a%20build%20system&s_o=default#)
  - [Oldest](https://disqus.com/embed/comments/?base=default&f=crave-io&t_i=275%20https%3A%2F%2Fwww.crave.io%2F%3Fp%3D275&t_u=https%3A%2F%2Fcrave.io%2Fevolution-of-a-build-system%2F&t_e=Evolution%20of%20a%20build%20system&t_d=Evolution%20of%20a%20build%20system%20%E2%80%93%20Crave.io&t_t=Evolution%20of%20a%20build%20system&s_o=default#)

Be the first to comment.

[Load more comments](https://disqus.com/embed/comments/?base=default&f=crave-io&t_i=275%20https%3A%2F%2Fwww.crave.io%2F%3Fp%3D275&t_u=https%3A%2F%2Fcrave.io%2Fevolution-of-a-build-system%2F&t_e=Evolution%20of%20a%20build%20system&t_d=Evolution%20of%20a%20build%20system%20%E2%80%93%20Crave.io&t_t=Evolution%20of%20a%20build%20system&s_o=default#)

live.rezync.com

# live.rezync.com is blocked

This page has been blocked by an extension

- Try disabling your extensions.

ERR\_BLOCKED\_BY\_CLIENT

Reload

This page has been blocked by an extension

pippio.com

# pippio.com is blocked

This page has been blocked by an extension

- Try disabling your extensions.

ERR\_BLOCKED\_BY\_CLIENT

Reload

This page has been blocked by an extension

[Remote builds for Open Source developers »](https://crave.io/remote-builds-for-open-source-developers/)

We use cookies to facilitate and improve interactions with our websites and services, to better understand how our websites and services are used and to personalize advertisements. For more information, including how to manage or change the settings of cookies, click here.

By continuing your visit to this site, you accept the use of cookies for the purposes above. ACCEPT

Privacy & Cookies Policy

Close

#### Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities...

Necessary

Necessary

Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.

SAVE & ACCEPT
