Skip to content

Commit 323cc2f

Browse files
committed
ci(docker): install gpustack-runtime in venv default
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 4e7a872 commit 323cc2f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

pack/Dockerfile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
# Argument usage:
1212
# - PYTHON_VERSION: Version of Python to use.
1313
# - 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.
1415
ARG PYTHON_VERSION=3.11
1516
ARG GPUSTACK_RUNTIME_BASE_IMAGE=runtime
17+
ARG GPUSTACK_RUNTIME_VENV_INSTALL=true
1618

1719
FROM ubuntu:22.04@sha256:3c61d3759c2639d4b836d32a2d3c83fa0214e36f195a3421018dbaaf79cbe37f AS runtime
1820
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
@@ -232,14 +234,30 @@ ARG TARGETARCH
232234

233235
## Install
234236

237+
ARG GPUSTACK_RUNTIME_VENV_INSTALL
238+
235239
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
238249

250+
# Install gpustack-runtime
251+
export UV_PRERELEASE=allow
252+
export UV_NO_CACHE=1
239253
uv pip install \
240254
/workspace/runtime
241-
242255
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
243261
EOF
244262

245263
## Entrypoint

0 commit comments

Comments
 (0)