Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
Signed-off-by: Kornilios Kourtis <[email protected]>
  • Loading branch information
kkourt committed Jul 20, 2022
0 parents commit 4109eb1
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

OCIORG ?= quay.io/lvh-images
LVH ?= $(OCIORG)/lvh
ROOT_BUILDER ?= $(OCIORG)/root-builder
ROOT_IMAGES ?= $(OCIORG)/root-images
DOCKER ?= docker

.PHONY: images
images:
$(DOCKER) build -f dockerfiles/root-builder -t $(ROOT_BUILDER) .
$(DOCKER) build -f dockerfiles/root-images -t $(ROOT_IMAGES) .
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This repository contains (little-vm-helper)[https://github.com/cilium/little-vm-helper]
configuration files and dockerfiles for building kernel and rootfs images.

- [configuration](_data/images.json) for building root images (single image for now)
- [dockerfile](./dockerfiles/root-builder) for a container that can be used to build root images
- [dockerfile](./dockerfiles/root-images) for a container with the root images

### Issues
- Using docker build means that there will be no /dev/kvm device in the builder which will
unfortunately result in slower builds than what you would get otherwise. There are some hints
in https://github.com/moby/moby/issues/1916 that this might be solved using buildx, but I'm not
sure how.
2 changes: 2 additions & 0 deletions _data/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
images
kernels
2 changes: 2 additions & 0 deletions _data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/images
/kernels
24 changes: 24 additions & 0 deletions _data/images.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"name": "base.qcow2",
"packages": [
"less",
"vim",
"sudo",
"openssh-server",
"curl",
"bpftool",
"iproute2",
"util-linux"
],
"actions": [
{
"comment": "disable password for root",
"op": {
"Cmd": "passwd -d root"
},
"type": "run-command"
}
]
}
]
9 changes: 9 additions & 0 deletions dockerfiles/root-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# vim: set ft=dockerfile:
FROM quay.io/lvh-images/lvh AS lvh

FROM debian:sid
WORKDIR /
RUN apt-get update -yq && \
apt-get upgrade -yq && \
apt-get install -yq mmdebstrap libguestfs-tools qemu-utils extlinux
COPY --from=lvh /usr/bin/lvh /usr/bin/lvh
10 changes: 10 additions & 0 deletions dockerfiles/root-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# vim: set ft=dockerfile:
FROM quay.io/lvh-images/root-builder AS builder
COPY _data /data
WORKDIR /data
# mmdebstrap outputs messages in stderr, so we redirect stderr
RUN lvh images build --dir . 2>&1

FROM busybox
COPY --from=builder /data/images/base.qcow2 /images/base.qcow2
RUN gzip /images/base.qcow2

0 comments on commit 4109eb1

Please sign in to comment.