|
11 | 11 | # Argument usage: |
12 | 12 | # - PYTHON_VERSION: Version of Python to use. |
13 | 13 | # - GPUSTACK_RUNTIME_BASE_IMAGE: Base image for the gpustack-runtime stage. |
| 14 | +# - GPUSTACK_RUNTIME_VENV_INSTALL: Whether to install GPUStack runtime in a virtual environment. |
14 | 15 | ARG PYTHON_VERSION=3.11 |
15 | 16 | ARG GPUSTACK_RUNTIME_BASE_IMAGE=runtime |
| 17 | +ARG GPUSTACK_RUNTIME_VENV_INSTALL=true |
16 | 18 |
|
17 | 19 | FROM ubuntu:22.04@sha256:3c61d3759c2639d4b836d32a2d3c83fa0214e36f195a3421018dbaaf79cbe37f AS runtime |
18 | 20 | SHELL ["/bin/bash", "-eo", "pipefail", "-c"] |
@@ -232,14 +234,30 @@ ARG TARGETARCH |
232 | 234 |
|
233 | 235 | ## Install |
234 | 236 |
|
| 237 | +ARG GPUSTACK_RUNTIME_VENV_INSTALL |
| 238 | + |
235 | 239 | RUN --mount=type=bind,target=/workspace/runtime,rw <<EOF |
236 | | - export UV_SYSTEM_PYTHON=1 |
237 | | - export UV_PRERELEASE=allow |
| 240 | + # Prepare environment |
| 241 | + if [[ "${GPUSTACK_RUNTIME_VENV_INSTALL}" == "true" ]]; then |
| 242 | + echo "Installing GPUStack runtime in a virtual environment..." |
| 243 | + uv venv /opt/gpustack-runtime |
| 244 | + source /opt/gpustack-runtime/bin/activate |
| 245 | + else |
| 246 | + echo "Installing GPUStack runtime in the system Python environment..." |
| 247 | + export UV_SYSTEM_PYTHON=1 |
| 248 | + fi |
238 | 249 |
|
| 250 | + # Install gpustack-runtime |
| 251 | + export UV_PRERELEASE=allow |
| 252 | + export UV_NO_CACHE=1 |
239 | 253 | uv pip install \ |
240 | 254 | /workspace/runtime |
241 | | - |
242 | 255 | uv pip tree |
| 256 | + |
| 257 | + # Symlink gpustack-runtime if installed in a virtual environment |
| 258 | + if [[ $(which gpustack-runtime) == "/opt/gpustack-runtime/bin/gpustack-runtime" ]]; then |
| 259 | + ln -s /opt/gpustack-runtime/bin/gpustack-runtime /usr/bin/gpustack-runtime |
| 260 | + fi |
243 | 261 | EOF |
244 | 262 |
|
245 | 263 | ## Entrypoint |
|
0 commit comments