File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 tags : ['v*']
88 paths :
99 - ' examples/**'
10+ - ' host/**'
1011 - ' runtimes/**'
1112 - ' .github/workflows/publish-examples.yml'
1213
@@ -230,6 +231,37 @@ jobs:
230231 docker push $VERSION_TAG
231232 fi
232233
234+ # Publish a runnable pyhl container image (pyhl + kernel + initrd).
235+ # Designed for the hyperlight-on-kubernetes device plugin — the pod
236+ # gets /dev/kvm and pyhl handles VM lifecycle internally.
237+ publish-pyhl :
238+ needs : [publish-pyhl-initrd, publish-kernels]
239+ runs-on : ubuntu-latest
240+ permissions :
241+ contents : read
242+ packages : write
243+ steps :
244+ - uses : actions/checkout@v4
245+
246+ - name : Log in to GHCR
247+ uses : docker/login-action@v3
248+ with :
249+ registry : ${{ env.REGISTRY }}
250+ username : ${{ github.actor }}
251+ password : ${{ secrets.GITHUB_TOKEN }}
252+
253+ - name : Build and push pyhl image
254+ run : |
255+ IMAGE=${{ env.IMAGE_BASE }}/pyhl:latest
256+ docker build --platform linux/amd64 \
257+ -f host/pyhl.Dockerfile -t $IMAGE .
258+ docker push $IMAGE
259+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
260+ VERSION_TAG=${{ env.IMAGE_BASE }}/pyhl:${{ github.ref_name }}
261+ docker tag $IMAGE $VERSION_TAG
262+ docker push $VERSION_TAG
263+ fi
264+
233265 # Publish the python-agent-driver rootfs CPIO as its own image so
234266 # `pyhl setup` can pull the initrd (and kernel, above) from GHCR
235267 # without having to build the driver image locally.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ if [ ! -f " $PYHL_HOME /snapshot/index.json" ]; then
5+ staging=$( mktemp -d)
6+ trap ' rm -rf "$staging"' EXIT
7+ mkdir -p " $staging /.unikraft/build"
8+ ln -s " $PYHL_HOME /kernel" " $staging /.unikraft/build/driver_hyperlight-x86_64"
9+ ln -s " $PYHL_HOME /initrd.cpio" " $staging /driver-initrd.cpio"
10+ pyhl setup --dest " $PYHL_HOME " --from " $staging " --net --force
11+ fi
12+
13+ if [ " $1 " = " --setup-only" ]; then
14+ exit 0
15+ fi
16+
17+ exec pyhl run --dest " $PYHL_HOME " --net " $@ "
Original file line number Diff line number Diff line change 1+ # pyhl container image — runs Python scripts in Hyperlight micro-VMs.
2+ #
3+ # Bundles the pyhl CLI, the python-agent-driver kernel, and its initrd
4+ # into a single runnable container. Designed for the
5+ # hyperlight-on-kubernetes device plugin: the pod gets /dev/kvm via
6+ # `hyperlight.dev/hypervisor: "1"` and pyhl handles the rest.
7+ #
8+ # Build (from repo root):
9+ # docker build -f host/pyhl.Dockerfile -t pyhl .
10+ #
11+ # Run:
12+ # docker run --rm --device /dev/kvm pyhl /path/to/script.py
13+ # echo 'print("hi")' | docker run --rm -i --device /dev/kvm pyhl -
14+
15+ FROM rust:1.87-bookworm AS builder
16+ COPY host/ /src/host/
17+ WORKDIR /src/host
18+ RUN cargo build --release --bin pyhl
19+
20+ FROM ghcr.io/hyperlight-dev/hyperlight-unikraft/python-agent-driver-kernel:latest AS kernel
21+ FROM ghcr.io/hyperlight-dev/hyperlight-unikraft/python-agent-driver-initrd:latest AS initrd
22+
23+ FROM debian:bookworm-slim
24+ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
25+ && rm -rf /var/lib/apt/lists/*
26+ COPY --from=builder /src/host/target/release/pyhl /usr/local/bin/
27+ COPY --from=kernel /kernel /opt/pyhl/kernel
28+ COPY --from=initrd /initrd.cpio /opt/pyhl/initrd.cpio
29+ COPY host/pyhl-entrypoint.sh /entrypoint.sh
30+ RUN chmod +x /entrypoint.sh && chown -R 65534:65534 /opt/pyhl
31+ ENV PYHL_HOME=/opt/pyhl
32+ USER 65534
33+ ENTRYPOINT ["/entrypoint.sh" ]
You can’t perform that action at this time.
0 commit comments