From 6cd465640cf804bd5e45147d015c68346536d09f Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 8 Dec 2025 19:38:15 +0100 Subject: [PATCH] added --- Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8033a58..adc1020 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,16 @@ FROM ubuntu:${UBUNTU_VERSION} LABEL maintainer="thommyho" LABEL description="An Ubuntu image with essential tools for git development and CI/CD pipelines." +# Re-declare ARG to make it available inside the build stages (optional, but good practice) +ARG UBUNTU_VERSION + ENV NVM_DIR=/usr/local/nvm \ NODE_VERSION=24.11.1 \ NODE_PATH=/usr/local/nvm/v24.11.1/lib/node_modules \ - PATH=/usr/local/nvm/versions/node/v24.11.1/bin:$PATH + PATH=/usr/local/nvm/versions/node/v24.11.1/bin:$PATH \ + # This variable fixes the issue: it allows system-wide pip installs on Ubuntu 24.04+ + # and is safely ignored by older Ubuntu versions (22.04, 20.04). + PIP_BREAK_SYSTEM_PACKAGES=1 RUN apt-get update && apt-get install -y --no-install-recommends \ git \ @@ -20,15 +26,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ python3-pip \ && rm -rf /var/lib/apt/lists/* -# Install conan only for Ubuntu 24.04 or newer -RUN UBUNTU_MAJOR_VERSION=$(cut -d'.' -f1 <<<"$UBUNTU_VERSION") && \ - if [ "$UBUNTU_MAJOR_VERSION" -ge 24 ]; then \ - pip install conan --break-system-packages; \ - fi +# Consolidated conan installation into one step. +# The PIP_BREAK_SYSTEM_PACKAGES environment variable handles the version logic automatically. +RUN pip install conan RUN mkdir -p $NVM_DIR && \ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \ . $NVM_DIR/nvm.sh && \ nvm install $NODE_VERSION && \ nvm use $NODE_VERSION && \ - nvm alias default $NODE_VERSION \ No newline at end of file + nvm alias default $NODE_VERSION