This commit is contained in:
2025-12-08 19:38:15 +01:00
parent 864987dc75
commit 6cd465640c

View File

@@ -5,10 +5,16 @@ FROM ubuntu:${UBUNTU_VERSION}
LABEL maintainer="thommyho" LABEL maintainer="thommyho"
LABEL description="An Ubuntu image with essential tools for git development and CI/CD pipelines." 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 \ ENV NVM_DIR=/usr/local/nvm \
NODE_VERSION=24.11.1 \ NODE_VERSION=24.11.1 \
NODE_PATH=/usr/local/nvm/v24.11.1/lib/node_modules \ 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 \ RUN apt-get update && apt-get install -y --no-install-recommends \
git \ git \
@@ -20,15 +26,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \ python3-pip \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install conan only for Ubuntu 24.04 or newer # Consolidated conan installation into one step.
RUN UBUNTU_MAJOR_VERSION=$(cut -d'.' -f1 <<<"$UBUNTU_VERSION") && \ # The PIP_BREAK_SYSTEM_PACKAGES environment variable handles the version logic automatically.
if [ "$UBUNTU_MAJOR_VERSION" -ge 24 ]; then \ RUN pip install conan
pip install conan --break-system-packages; \
fi
RUN mkdir -p $NVM_DIR && \ RUN mkdir -p $NVM_DIR && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
. $NVM_DIR/nvm.sh && \ . $NVM_DIR/nvm.sh && \
nvm install $NODE_VERSION && \ nvm install $NODE_VERSION && \
nvm use $NODE_VERSION && \ nvm use $NODE_VERSION && \
nvm alias default $NODE_VERSION nvm alias default $NODE_VERSION