@@ -48,6 +48,8 @@ RUN set -eux; \
4848 find /deps -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true; \
4949 find /deps -type f -name '*.pyc' -delete 2>/dev/null || true; \
5050 find /deps -name '*.so*' -exec strip --strip-unneeded {} + 2>/dev/null || true
51+ # Download a small wheel for the pip-install demo
52+ RUN pip download --no-deps --dest /wheels six
5153
5254# Stage 2: build hl_pydriver against the SAME Python 3.12-from-source
5355# that produces local-python-base, so the glibc/libpython3.12.so ABI
@@ -71,6 +73,17 @@ COPY --from=deps /deps /usr/local/lib/python3.12/site-package
7173COPY --from=driver-build /src/hl_pydriver /bin/hl_pydriver
7274COPY pydoc_stub.py /usr/local/lib/python3.12/pydoc.py
7375
76+ # pip: the python-base image strips pip for size; bring it back from the
77+ # deps stage (python:3.12-slim) so `python3 -m pip install` works as a
78+ # subprocess.
79+ COPY --from=deps /usr/local/lib/python3.12/site-packages/pip \
80+ /usr/local/lib/python3.12/site-packages/pip
81+
82+ # stdlib modules that python-base strips but pip needs at runtime
83+ COPY --from=deps /usr/local/lib/python3.12/xmlrpc \
84+ /usr/local/lib/python3.12/xmlrpc
85+
86+
7487# Stage 4: pack CPIO.
7588FROM alpine:3.20 AS cpio
7689RUN apk add --no-cache cpio findutils ca-certificates
@@ -88,4 +101,25 @@ RUN mkdir -p /rootfs/etc/ssl/certs /rootfs/usr/lib/ssl && \
88101 cp /etc/ssl/certs/ca-certificates.crt /rootfs/etc/ssl/certs/ && \
89102 ln -sf /etc/ssl/certs/ca-certificates.crt /rootfs/usr/lib/ssl/cert.pem
90103
104+ # pip configuration: disable version-check (no internet during warm-up)
105+ RUN mkdir -p /rootfs/etc && \
106+ printf '[global]\n disable-pip-version-check = true\n ' > /rootfs/etc/pip.conf
107+
108+ # /tmp for pip's temp files during install
109+ RUN mkdir -p /rootfs/tmp
110+
111+ # Pre-downloaded wheels for the pip-install demo
112+ COPY --from=deps /wheels /rootfs/wheels
113+
114+ # Busybox: use the static-PIE build from the shell-base image.
115+ # Alpine's busybox-static is ET_EXEC (non-PIE) which the elfloader
116+ # rejects; the shell-base image has a static-PIE (ET_DYN) build.
117+ COPY --from=ghcr.io/hyperlight-dev/hyperlight-unikraft/shell-base:latest \
118+ /bin/busybox /rootfs/bin/busybox
119+ RUN for cmd in sh echo ls cat grep find wc head tail sort cut sed awk \
120+ cp mv rm mkdir rmdir ln basename dirname env sleep date \
121+ hostname id uname whoami which test true tr uniq tee xargs; do \
122+ ln -sf busybox /rootfs/bin/$cmd; \
123+ done
124+
91125RUN cd /rootfs && find . | cpio -o -H newc > /output.cpio 2>/dev/null
0 commit comments