Skip to content

Commit 550782d

Browse files
committed
Update README and examples with the new cmd format
Update the README and the examples to reflect the changes in the handling of command line arguments for the application. In particular, replace cmdline with cmd in bunnyfile and the cmdline annotation with CMD in Containerfiles. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
1 parent b079bca commit 550782d

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ kernel: # [5] Specify a prebuilt kernel
6262
from: local # [5a] Specify the source of a prebuilt kernel.
6363
path: local # [5b] The path where the kernel image resides.
6464
65-
cmdline: hello # [6] The cmdline of the app.
65+
cmd: ["hello"] # [6] The command line arguments of the app.
6666
6767
```
6868

@@ -178,7 +178,7 @@ kernel:
178178
from: local
179179
path: kernel
180180
181-
cmdline: /server
181+
cmd: ["/server"]
182182
```
183183

184184
We can then package everything with the following command:
@@ -193,7 +193,7 @@ The above `bunnyfile` will perform the following steps:
193193
2. Copy the file `kernel` from the local build context to the OCI image we used
194194
in the previous step at `/boot/kernel`.
195195
3. Set up [`urunc`'s annotations](https://urunc.io/image-building/#annotations)
196-
using all the information in the file (e.g. framework, version, cmdline,
196+
using all the information in the file (e.g. framework, version, cmd,
197197
binary, initrd).
198198
4. Produce the final OCI image.
199199

examples/CHTTP_Unikraft.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Creating the initrd and packaging a Unikraft unikernel with `bunny`
22

33
For this example, we will use the [C HTTP Web
4-
Server](https://github.com/unikraft/catalog/tree/main/examples/http-c) example
4+
Server](https://github.com/unikraft/catalog/tree/main/examples/httpserver-gcc13.2) example
55
in Unikraft's catalog. To build the unikernel, we mainly need to:
66
1. Build the C HTTP server
77
2. Create the initrd for Unikraft
@@ -52,10 +52,14 @@ To package everything together, we can use the following `Containerfile`:
5252
#syntax=harbor.nbfc.io/nubificus/bunny:latest
5353
FROM unikraft.org/base:latest
5454
55+
COPY rootfs.cpio /rootfs.cpio
56+
5557
LABEL com.urunc.unikernel.binary="/unikraft/bin/kernel"
56-
LABEL "com.urunc.unikernel.cmdline"="/chttp"
58+
LABEL "com.urunc.unikernel.initrd"="/rootfs.cpio"
5759
LABEL "com.urunc.unikernel.unikernelType"="unikraft"
5860
LABEL "com.urunc.unikernel.hypervisor"="qemu"
61+
62+
CMD ["/chttp"]
5963
```
6064

6165
## Using a `bunnyfile`
@@ -84,7 +88,7 @@ kernel:
8488
from: unikraft.org/base:latest
8589
path: /unikraft/bin/kernel
8690
87-
cmdline: /chttp
91+
cmd: ["/chttp"]
8892
```
8993

9094
With the above bunnyfile`, `bunny` will build the rootfs of Unikraft as a cpio

examples/Nginx_Unikraft.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Packaging a Unikraft unikernel with `bunny`
22

3-
For this example, we will use an existing [Unikraft](unikraft.org) Unikernel
3+
For this example, we will use an existing [Unikraft](https://unikraft.org/) Unikernel
44
image from [Unikraft's catalog](https://github.com/unikraft/catalog), we can
55
transform it to an image that [urunc](https://github.com/nubificus/urunc) can
66
execute with `bunny`. The respective `Containerfile` that we would use with
@@ -11,9 +11,10 @@ execute with `bunny`. The respective `Containerfile` that we would use with
1111
FROM unikraft.org/nginx:1.15
1212
1313
LABEL com.urunc.unikernel.binary="/unikraft/bin/kernel"
14-
LABEL "com.urunc.unikernel.cmdline"="nginx -c /nginx/conf/nginx.conf"
1514
LABEL "com.urunc.unikernel.unikernelType"="unikraft"
1615
LABEL "com.urunc.unikernel.hypervisor"="qemu"
16+
17+
CMD ["-c", "/nginx/conf/nginx.conf"]
1718
```
1819

1920
In order to use `bunny`, instead, we need to specify the
@@ -33,7 +34,7 @@ kernel:
3334
from: unikraft.org/nginx:1.15
3435
path: /unikraft/bin/kernel
3536
36-
cmdline: nginx -c /nginx/conf/nginx.conf
37+
cmd: ["-c", "/nginx/conf/nginx.conf"]
3738
```
3839

3940
## Building the image with bunny as buildkit's frontend

examples/Redis_Rumprun.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ The respective `Containerfile` that we would use with
1111
[bima](https://github.com/nubificus/bima) would be:
1212

1313
```
14-
#syntax=harbor.nbfc.io/nubificus/pun:latest
14+
#syntax=harbor.nbfc.io/nubificus/bunny:latest
1515
FROM scratch
1616
1717
COPY redis.hvt /unikernel/redis.hvt
18-
COPY redis.conf /conf/redis.conf
18+
COPY /conf /
1919
2020
LABEL com.urunc.unikernel.binary=/unikernel/redis.hvt
21-
LABEL "com.urunc.unikernel.cmdline"="redis-server /data/conf/redis.conf"
2221
LABEL "com.urunc.unikernel.unikernelType"="rumprun"
2322
LABEL "com.urunc.unikernel.hypervisor"="hvt"
23+
LABEL "com.urunc.unikernel.mountRootfs"="true"
24+
25+
CMD ["redis-server", "/data/conf/redis.conf"]
2426
```
2527

2628
In order to use `bunny`, instead, we need to specify the
@@ -40,13 +42,13 @@ rootfs:
4042
from: scratch
4143
type: raw
4244
include:
43-
- redis.conf:/data/conf/redis.conf
45+
- conf/:/conf
4446
4547
kernel:
4648
from: local
4749
path: redis.hvt
4850
49-
cmdline: "redis-server /data/conf/redis.conf"
51+
cmd: ["redis-server", "/data/conf/redis.conf"]
5052
```
5153

5254
> **NOTE**: Since we use the raw type for rootfs, all the files in the include list

0 commit comments

Comments
 (0)