Skip to content

Conversation

jschaul
Copy link
Member

@jschaul jschaul commented Feb 1, 2021

buildah-compile.sh compiles wire-server inside an alpine-based container based on quay.io/wire/alpine-builder.
the tool 'buildah' is used to mount some folders in, and to
keep the stack caches of .stack and .stack-work (renamed to avoid conflicts) for the next compilation.

After compilation, ./buildah-make-images.sh can be used
to bake individual executables into their respective docker images used by kubernetes.

Usage: just run 'make buildah-docker' which will compile and upload
images to quay.io under the docker tag $USER by default.

On my machine, the overhead (from a successful stack build of wire-server to a set of ~15 docker images locally) is 1.5 minutes. Pushing to quay.io depends on your internet connection. Pushing to a local kubernetes cluster would be faster.

FUTUREWORK: build only some, not all images. (good luck figuring out the bash syntax to pass space-separated executables as arguments...)
FUTUREWORK: provide buildah using nix
FUTUREWORK: parameterize having or not --fast and maybe also use this on CI
FUTUREWORK: remove some docker makefile targets that are somewhat outdated

@jschaul jschaul force-pushed the faster-local-docker-images branch from 47ab321 to 5850b71 Compare February 1, 2021 21:11
buildah-compile.sh compiles wire-server inside an alpine-based container based on quay.io/wire/alpine-builder.
the tool 'buildah' is used to mount some folders in, and to
keep the stack caches of .stack and .stack-work (renamed to avoid conflicts) for the next compilation

After compilation, ./buildah-make-images.sh can be used
to bake individual executables into their respective docker images used by kubernetes.

Usage: just run 'make buildah-docker' which will compile and upload
images to quay.io under the docker tag $USER by default.
@jschaul jschaul force-pushed the faster-local-docker-images branch from 6a054dc to 24e9617 Compare February 2, 2021 22:42
@jschaul jschaul changed the title [WIP] [skip ci] faster local docker image building using buildah [skip ci] faster local docker image building using buildah Feb 2, 2021
@jschaul jschaul marked this pull request as ready for review February 2, 2021 22:49
@jschaul
Copy link
Member Author

jschaul commented Feb 2, 2021

Updated description. Ready for review now.

Copy link
Member

@akshaymankar akshaymankar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some FUTUREWORK comments in code. Looks good!

@arianvp
Copy link
Contributor

arianvp commented Feb 3, 2021

We wanted to move away from buildkit to buildah in concourse as well. So I guess this comes in handy. :)

I was under the impression that buildah could consume Containerfile/Dockerfiles so I'm a bit surprised we are moving away from a Containerfile to a shell-script. But I don't have a very strong opinion on the matter. Is it because Dockerfile doesn't support mounting the cache folders?

@jschaul jschaul force-pushed the faster-local-docker-images branch from d4c1c37 to 860a42b Compare February 3, 2021 11:32
@jschaul jschaul merged commit 7e1c06a into develop Feb 3, 2021
@jschaul jschaul deleted the faster-local-docker-images branch February 3, 2021 11:33
@akshaymankar
Copy link
Member

Is it because Dockerfile doesn't support mounting the cache folders?

Yep, ability to mount folders into a building container was the main reason to try out buildah.

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

Successfully merging this pull request may close these issues.

3 participants