Skip to content

Instantly share code, notes, and snippets.

@abitrolly
Last active April 18, 2020 12:35
Show Gist options
  • Save abitrolly/082d7a40827a0c6d025ed4916f738f79 to your computer and use it in GitHub Desktop.
Save abitrolly/082d7a40827a0c6d025ed4916f738f79 to your computer and use it in GitHub Desktop.
What is Buildpack?

It takes your source app code and containerizes it.

Yes, it is a Dockerfile replacement. Instead of creating Dockerfile for every little script you might have, just let the buildpack do the job.

What is lifecycle?

It is a go program that executes logic in buildpacks. Much like docker build . executes Dockerfile, the lifecycle executes buildpack.

Why the hype?

Many users are still on VM world. This is far outdated. We need to introduces containers. The c* word doesn't reflect what a container really is. Linux docs about namespaces are confusing. To take an example for the Real World, the container is your reflection in a mirror that starts to live its own life at some point. And it can not escape the mirror. It is on the other side. Linux kernel has the ability to reflect itself into those isolated mirrors and continue to do things there. This is the core building block.

But running Linux kernel alone is not interesting. It is like all API is there, but nothing moves, because there is no process to use them. Docker guys invented a way to add application stuff to that mirror - the image. You prepare the image that you want to see in the mirror, and when Linux reflects, it starts to interact with the new image there.

Traditionally the images were constructed using file with instructions - Dockerfile. It allowed to set environment variables, add files, and even process them in temporary mirror that was destroyed afterwards. Dockerfiles were readable, but inconvenient. For every script that you want to run in a mirror, you need an image, and hence the Dockerfile.

Then smart guys from Heroku appeared. Not only they had a lot of experience to create the concept of 12-factor apps, but also invented a smart way to create containers for their platform - the buildpack. If Dockerfile were just a set of readable simple instruction without much logic excuted by docker, then the buildpack itself is tool that analyzes application source and figures out how to pack it the best way to be executed. Instead of creating Dockerfile you were creating the buildpack, but many of those were already created. Heroku platform itself was using buildpack to validate and prepare the app to run on its servers. Others followed.

How to build and run app containerized by buildpack?

pack is the tool to build the stuff.

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