Bootstrap: localimage From: ./vllm-v0.24.0-cu129.sif %labels org.opencontainers.image.title vllm-berag org.opencontainers.image.base.name vllm/vllm-openai:v0.24.0-cu129 org.opencontainers.image.revision 2ca4f5b4fe3aa8018ee5f6bd014a6684570642d9 org.opencontainers.image.source https://github.com/EriChen0615/vllm-berag %files ./build/vllm-berag-src /opt/ %post set -eu VLLM_PACKAGE_DIR=/usr/local/lib/python3.12/dist-packages/vllm test -d "$VLLM_PACKAGE_DIR" test -d /opt/vllm-berag-src/vllm # Preserve the base image's compiled extensions while replacing and # adding the Python files from the BERAG source snapshot. cp -a /opt/vllm-berag-src/vllm/. "$VLLM_PACKAGE_DIR/" %environment export HF_HOME=/cache/huggingface export PYTHONUNBUFFERED=1 export VLLM_USAGE_SOURCE=production-sif-image %test VLLM_PACKAGE_DIR=/usr/local/lib/python3.12/dist-packages/vllm test -f "$VLLM_PACKAGE_DIR/berag.py" grep -q 'def generate_berag' "$VLLM_PACKAGE_DIR/entrypoints/llm.py" find "$VLLM_PACKAGE_DIR" -maxdepth 1 \ -name '_C_stable_libtorch*.so' -print -quit | grep -q . %runscript exec vllm serve "$@" %help vllm-berag based on vllm/vllm-openai:v0.24.0-cu129. The BERAG source snapshot is stored at /opt/vllm-berag-src. Its Python files are merged into the upstream package at build time so that the base image's compiled CUDA extensions are preserved. Run with NVIDIA GPU support, for example: apptainer exec --nv IMAGE.sif python3 -c \ 'import torch, vllm; print(vllm.__file__); print(torch.__version__)' apptainer run --nv IMAGE.sif MODEL_NAME --host 0.0.0.0 --port 8000