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

build images faster using buildkit #3

Open
kkourt opened this issue Aug 16, 2022 · 0 comments
Open

build images faster using buildkit #3

kkourt opened this issue Aug 16, 2022 · 0 comments

Comments

@kkourt
Copy link
Collaborator

kkourt commented Aug 16, 2022

Current image builds are slowed down because there is no /dev/kvm in the build container. docker build does not support this, but buildkit does.

new dockerfile:

--- dockerfiles/root-images     2022-08-16 15:37:33.772545638 +0200
+++ dockerfiles/root-images-insecure    2022-08-16 15:37:18.772581443 +0200
@@ -1,8 +1,9 @@
+# syntax = docker/dockerfile:experimental
 # vim: set ft=dockerfile:
 FROM quay.io/lvh-images/root-builder AS builder
 COPY _data /data
 # mmdebstrap outputs messages in stderr, so we redirect stderr
-RUN lvh images build --dir /data 2>&1
+RUN --security=insecure lvh images build --dir /data 2>&1
 RUN zstd --compress --rm --threads=0 /data/images/*.qcow2
 
 # Can't use scratch here because we use `docker create` elsewhere, and

Steps:

$ docker buildx create --driver docker-container --name local --buildkitd-flags '--allow-insecure-entitlement security.insecure' --driver-opt image=moby/buildkit:master --use
$ docker buildx build --allow security.insecure . -f dockerfiles/root-images-insecure

This leads to x2 faster build on my laptop.

Links:

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

1 participant