From 0511614737a9ff1c407b92a9b011407cf4715005 Mon Sep 17 00:00:00 2001 From: Chris Kay Date: Fri, 1 Aug 2025 14:46:42 +0100 Subject: [PATCH] ci: fix virtual environment configuration Shrinkwrap does not always run its build containers as the root user, which renders the virtual environment installed within the root user's home directory inaccessible. This change moves two directories into globally-accessible locations: - The uv Python installation directory: /opt/python - The global virtual environment: /opt/python-venv This change instead installs the Python virtual environment to a global directory - `/opt/python` - to make installed Python binaries accessible to non-root users. This fixes an additional issue where uv was also not syncing to the correct virtual environment to begin with, and was instead trying to sync a new project environment in `/shrinkwrap`. Signed-off-by: Chris Kay --- docker/Dockerfile.slim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.slim b/docker/Dockerfile.slim index f82c86a..182c0cb 100644 --- a/docker/Dockerfile.slim +++ b/docker/Dockerfile.slim @@ -19,12 +19,13 @@ RUN apt-get install --assume-yes --no-install-recommends --option=debug::pkgProb curl # Install uv -RUN curl -LsSf https://astral.sh/uv/install.sh | sh -ENV PATH="/root/.local/bin:${PATH}" +COPY --from=ghcr.io/astral-sh/uv:0.8.4 /uv /uvx /bin/ +ENV UV_PYTHON_INSTALL_DIR="/opt/python" # Set up a global Python virtual environment -RUN uv venv "/root/.venv" -ENV PATH="/root/.venv/bin:${PATH}" +RUN uv venv "/opt/python-venv" +ENV VIRTUAL_ENV="/opt/python-venv" +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" # We now install packages required by all the FW components that Shrinkwrap # supports building. Often there are overlapping components, but we (re)specify -- GitLab