-
Notifications
You must be signed in to change notification settings - Fork 7
/
kind-images
59 lines (50 loc) · 2.02 KB
/
kind-images
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# syntax=docker/dockerfile:1.3-labs
# vim: set ft=dockerfile:
ARG ROOT_IMAGES_TAG=invalid
# override this with --build-arg
ARG KERNEL_VER=bpf-next
ARG KERNEL_IMAGE_TAG=bpf-next
FROM quay.io/lvh-images/root-images-ci:"${ROOT_IMAGES_TAG}" AS root-images
FROM quay.io/lvh-images/kernel-images-ci:"${KERNEL_IMAGE_TAG}" AS kimg
FROM quay.io/lvh-images/lvh:v0.0.19 AS lvh
FROM ubuntu:rolling AS builder
ARG KERNEL_VER=bpf-next
WORKDIR /data
COPY --from=lvh /usr/bin/lvh /usr/bin/lvh
RUN apt-get update --quiet && \
apt-get upgrade --quiet --yes && \
apt-get install --quiet --yes --no-install-recommends \
zstd qemu-utils libguestfs-tools linux-image-generic
# this might be counter intuitive but without this package (or one of its
# subpackage), starting qemu with '-device virtio-net-pci,netdev=usernet' will
# fail with 'failed to find romfile "efi-virtio.rom"'
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ]; then apt-get install -yq --no-install-recommends qemu-system-x86; fi
COPY --from=kimg /data/kernels /data/kernels
COPY --from=root-images /data/images/kind.qcow2.zst /data/images/kind.qcow2.zst
RUN zstd --decompress --rm --threads=0 /data/images/kind.qcow2.zst
COPY <<EOF /data/images.json
[
{
\"name\": \"kind_"${KERNEL_VER}".qcow2\",
\"parent\": \"kind.qcow2\",
\"actions\": [
{
\"comment\": \"install "${KERNEL_VER}"\",
\"op\": {
\"KernelInstallDir\": \"/data/kernels/"${KERNEL_VER}"\"
},
\"type\": \"install-kernel\"
},
{ \"op\": { \"Hostname\": \"kind-"${KERNEL_VER}"\"}, \"type\": \"set-hostname\" }
]
}
]
EOF
RUN lvh version
# mmdebstrap outputs messages in stderr, so we redirect stderr
RUN LIBGUESTFS_BACKEND_SETTINGS=force_tcg lvh images build --image kind_${KERNEL_VER}.qcow2 --dir /data 2>&1
RUN zstd --compress --rm --threads=0 /data/images/kind_${KERNEL_VER}.qcow2
RUN rm /data/images/*.qcow2
FROM busybox
COPY --from=builder /data/images /data/images