-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathJustfile
More file actions
72 lines (61 loc) · 2.57 KB
/
Copy pathJustfile
File metadata and controls
72 lines (61 loc) · 2.57 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
# python-agent on Hyperlight
#
# A "productivity agent" Python environment — Jinja2, BeautifulSoup,
# openpyxl, pypdf, tenacity, tqdm, click, python-dotenv, tabulate,
# markdown-it-py, pyyaml — all exercised by agent.py to produce a
# small report. Outputs land in ./work/ via the --mount path.
#
# just run - Execute agent.py and drop artifacts under ./work/
# just exec CODE - Run arbitrary Python with the full dep stack loaded
# just rootfs - Rebuild the CPIO via Docker
# just build - Build/pull the kernel
# just clean - Remove build artifacts
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
export DOCKER_BUILDKIT := "0"
kernel := ".unikraft/build/python-agent-hyperlight_hyperlight-x86_64"
initrd := "python-agent-initrd.cpio"
memory := "1Gi"
image := "python-agent-hyperlight"
ghcr_kernel := "ghcr.io/hyperlight-dev/hyperlight-unikraft/python-agent-kernel:latest"
mount_dir := "./work"
[unix]
run:
mkdir -p {{mount_dir}}
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} --mount {{mount_dir}} -- /agent.py
[windows]
run:
New-Item -ItemType Directory -Force -Path {{mount_dir}} | Out-Null
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} --mount {{mount_dir}} -- /agent.py
[unix]
exec CODE:
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} --exec {{quote(CODE)}}
[windows]
exec CODE:
hyperlight-unikraft {{kernel}} --initrd {{initrd}} --memory {{memory}} --exec {{quote(CODE)}}
rootfs:
# --pull forces docker to refresh python-base from GHCR; the agent
# needs the shared libs the trimmed-but-recently-restocked base
# ships (libz, libffi, libssl, pyexpat, _ctypes, …).
docker build --platform linux/amd64 --pull --target cpio -t {{image}}-cpio .
- docker rm -f {{image}}-tmp
docker create --name {{image}}-tmp {{image}}-cpio /bin/true
docker cp {{image}}-tmp:/output.cpio ./{{initrd}}
docker rm -f {{image}}-tmp
[unix]
build:
-kraft-hyperlight build --plat hyperlight --arch x86_64
[windows]
build:
docker pull {{ghcr_kernel}}
- docker rm -f {{image}}-kernel-tmp
docker create --name {{image}}-kernel-tmp {{ghcr_kernel}} /kernel
New-Item -ItemType Directory -Force -Path (Split-Path {{kernel}}) | Out-Null
docker cp {{image}}-kernel-tmp:/kernel ./{{kernel}}
docker rm -f {{image}}-kernel-tmp
[unix]
clean:
rm -rf .unikraft {{initrd}}
[windows]
clean:
if (Test-Path .unikraft) { Remove-Item -Recurse -Force .unikraft }
if (Test-Path {{initrd}}) { Remove-Item -Force {{initrd}} }