Skip to content

Commit 2cf6195

Browse files
committed
WIP: dockerfile for producing kind images with different kernels
Signed-off-by: Mark Pashmfouroush <[email protected]>
1 parent fb55b57 commit 2cf6195

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

.github/workflows/buildx-kind.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: buildx-kind
2+
on:
3+
push:
4+
branches:
5+
- "markpash/kind-kernels"
6+
jobs:
7+
docker:
8+
strategy:
9+
matrix:
10+
kernel: [ "4.19", "5.4", "5.10", "bpf-next" ]
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 60
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Login to Quay.io
21+
uses: docker/login-action@v2
22+
with:
23+
registry: quay.io
24+
username: ${{ secrets.QUAY_USERNAME }}
25+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
26+
27+
- name: Build and push
28+
uses: docker/build-push-action@v3
29+
with:
30+
context: .
31+
file: dockerfiles/kind-image
32+
no-cache: true
33+
allow: |
34+
security.insecure
35+
build-args: |
36+
"KERNEL_VER=${{ matrix.kernel }}"
37+
push: true
38+
tags: lvh-images/kind:${{ matrix.kernel }}

dockerfiles/kind-image

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# syntax=docker/dockerfile:1.3-labs
2+
# vim: set ft=dockerfile:
3+
4+
# override this with --build-arg
5+
ARG KERNEL_VER=bpf-next
6+
7+
FROM quay.io/lvh-images/root-images:latest AS root-images
8+
FROM quay.io/lvh-images/kernel-images:"${KERNEL_VER}" AS kernel-image
9+
FROM quay.io/lvh-images/root-builder:latest AS builder
10+
11+
ARG KERNEL_VER=bpf-next
12+
13+
WORKDIR /data
14+
COPY --from=kernel-image /data/kernels /data/kernels
15+
COPY --from=root-images /data/images/kind.qcow2.zst /data/images/kind.qcow2.zst
16+
RUN zstd --decompress --rm --threads=0 /data/images/kind.qcow2.zst
17+
18+
COPY <<EOF /data/images.json
19+
[
20+
{
21+
\"name\": \"kind_"${KERNEL_VER}".qcow2\",
22+
\"parent\": \"kind.qcow2\",
23+
\"actions\": [
24+
{
25+
\"comment\": \"install "${KERNEL_VER}"\",
26+
\"op\": {
27+
\"KernelInstallDir\": \"/data/kernels/"${KERNEL_VER}"\"
28+
},
29+
\"type\": \"install-kernel\"
30+
},
31+
{
32+
\"comment\": \"run depmod against all kernels\",
33+
\"op\": {
34+
\"Cmd\": \"find /lib/modules/ -maxdepth 1 -mindepth 1 -type d -exec basename {} \';\' | xargs -n1 depmod\"
35+
},
36+
\"type\": \"run-command\"
37+
},
38+
{ \"op\": { \"Hostname\": \"kind-"${KERNEL_VER}"\"}, \"type\": \"set-hostname\" }
39+
]
40+
}
41+
]
42+
EOF
43+
44+
# mmdebstrap outputs messages in stderr, so we redirect stderr
45+
RUN lvh images build --image kind_${KERNEL_VER}.qcow2 --dir /data 2>&1
46+
RUN zstd --compress --rm --threads=0 /data/images/kind_${KERNEL_VER}.qcow2
47+
RUN rm /data/images/*.qcow2
48+
49+
FROM busybox
50+
COPY --from=builder /data/images /data/images

dockerfiles/root-images

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# vim: set ft=dockerfile:
2-
FROM quay.io/lvh-images/root-builder AS builder
2+
FROM quay.io/lvh-images/root-builder:latest AS builder
33
COPY _data /data
44
# mmdebstrap outputs messages in stderr, so we redirect stderr
55
RUN lvh images build --dir /data 2>&1

0 commit comments

Comments
 (0)