Initial commit

This commit is contained in:
Reynir Björnsson 2022-07-23 10:31:07 +02:00
commit f43f6276dd
3 changed files with 87 additions and 0 deletions

15
Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM ocaml/opam:ubuntu-20.04-ocaml-4.14 AS opam
COPY mirage-unikernel-unipi-spt.opam /home/opam/opam-repository/packages/mirage-unikernel-unipi-spt/mirage-unikernel-unipi-spt.0.0.1~dev/opam
RUN opam update
RUN opam depext mirage-unikernel-unipi-spt
RUN opam install mirage-unikernel-unipi-spt
RUN cp $(opam config var bin)/unipi.spt .
RUN cp $(opam config var bin)/solo5-elftool .
RUN cp $(opam config var bin)/solo5-spt .
FROM ubuntu:20.04
COPY --from=opam /home/opam/unipi.spt /unipi.spt
COPY --from=opam /home/opam/solo5-elftool /usr/local/bin/solo5-elftool
COPY --from=opam /home/opam/solo5-spt /usr/local/bin/solo5-spt
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh", "/unipi.spt"]

25
entrypoint.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
if [ "$#" -lt 1 ]; then
echo Must provide the unikernel as argument >&2
exit 2
fi
unikernel=$1
shift
ip=$(ip a show eth0 | awk '/inet/{print $2}') || {
echo Could not determine ip address >&2
exit 2
}
gateway=$(ip route show default | awk '/^default /{print $3}') || {
echo Could not determine default gateway >&2
exit 2
}
ip tuntap add mode tap name service
ip addr del "$ip" dev eth0
ip link add br0 type bridge
ip link set eth0 master br0
ip link set service master br0
ip link set br0 up
ip link set service up
solo5-spt --net:service=service -- "$unikernel" --ipv4="$ip" --ipv4-gateway="$gateway" "$@"

View file

@ -0,0 +1,47 @@
# Generated by _build/default/config.exe configure -t spt (2022-07-22 19:38:43-00:00).
opam-version: "2.0"
name: "mirage-unikernel-unipi-spt"
depends: [ "arp" { >= "3.0.0" & < "4.0.0"}
"awa"
"awa-mirage"
"ethernet" { >= "3.0.0" & < "4.0.0"}
"functoria-runtime"
"git" { >= "3.7.0"}
"git-mirage" { >= "3.7.0" & < "3.8.0"}
"git-paf" { >= "3.7.0"}
"irmin-mirage-git" { >= "2.10.0" & < "3.0.0"}
"letsencrypt" { >= "0.3.0"}
"logs"
"lwt"
"magic-mime"
"mimic"
"mirage" {build & >= "3.10.0" & < "3.11.0"}
"mirage-bootvar-solo5" { >= "0.6.0" & < "0.7.0"}
"mirage-clock-freestanding" { >= "3.0.0" & < "5.0.0"}
"mirage-crypto-rng-mirage" { >= "0.8.0" & < "0.11.0"}
"mirage-logs" { >= "1.2.0" & < "2.0.0"}
"mirage-net-solo5" { >= "0.6.1" & < "0.7.0"}
"mirage-runtime" { >= "3.10.0" & < "3.11.0"}
"mirage-solo5" { >= "0.6.1" & < "0.7.0"}
"mirage-types" { >= "3.10.0" & < "3.11.0"}
"mirage-types-lwt" { >= "3.10.0" & < "3.11.0"}
"ocaml" {build & >= "4.08.0"}
"ocamlbuild" {build}
"ocamlfind" {build}
"paf" { >= "0.0.8-1" & < "0.0.9"}
"paf-le" { >= "0.0.8-1" & < "0.0.9"}
"solo5-bindings-spt" { >= "0.6.0" & < "0.7.0"}
"tcpip" { >= "7.0.0" & < "8.0.0"}
"tls-mirage"
]
maintainer: "dummy"
authors: "dummy"
homepage: "dummy"
bug-reports: "dummy"
dev-repo: "git+https://example.com/nonexistent"
build: [ "sh" "-exc" "mirage configure -t spt && mirage build" ]
synopsis: "This is a dummy"
install: [
[ "cp" "unipi.spt" "%{bin}%/unipi.spt" ]
]
url { src: "git+https://github.com/roburio/unipi.git#main" }