Skip to content

build images faster using buildkit  #3

@kkourt

Description

@kkourt

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions