Dateien
rocm-systems/projects/rocprofiler-systems/docker/Dockerfile.ubuntu
T
David Galiffi c0f8627e7f Update CI Docker files (#1202)
- Add `nlohmann-json-dev` (or equivalent) to CI Docker images for RHEL, SUSE, and Ubuntu.
- Add `gmock-dev` and `gtest-dev` (or equivalent) to CI Docker images for RHEL, SUSE, and Ubuntu.
- Add `--set solver classic` to conda config to resolve an issue setting up the conda environment
- Fix Perfetto package installation on ubuntu noble image.
- Add a check and log error if pip installation fail 

---------

Co-authored-by: jbonnell-amd <jason.bonnell@amd.com>
2025-10-02 21:06:01 -04:00

70 Zeilen
3.0 KiB
Docker

ARG DISTRO
ARG VERSION
FROM ${DISTRO}:${VERSION}
ENV HOME=/root
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US
ENV LC_ALL=C
ENV SHELL=/bin/bash
ENV BASH_ENV=/etc/bash.bashrc
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /tmp
SHELL [ "/bin/bash", "-c" ]
ARG EXTRA_PACKAGES=""
ARG ROCM_VERSION="0.0"
ENV PATH=${HOME}/.local/bin:${PATH}
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y apt-utils autoconf autotools-dev bash-completion bison \
build-essential chrpath cmake curl flex gettext git-core gnupg2 iproute2 \
libgmock-dev libgtest-dev libnuma1 libopenmpi-dev libpapi-dev libpfm4-dev \
librpm-dev libsqlite3-dev libtool libudev1 lsb-release m4 ninja-build \
nlohmann-json3-dev python3-pip rpm texinfo wget && \
OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \
OS_ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \
if [ "${OS_ID}" == "ubuntu" ] && [ "${OS_VERSION}" == "22.04" ]; then \
python3 -m pip install 'cmake==3.21'; \
else \
python3 -m pip install --break-system-packages 'cmake==3.21' perfetto; \
fi
RUN ROCM_MAJOR=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $1}') && \
ROCM_MINOR=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $2}') && \
if [ "${ROCM_MAJOR}" != "0" ] || [ "${ROCM_MINOR}" != "0" ]; then \
OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \
OS_CODENAME=$(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2) && \
ROCM_PATCH=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $3}') && \
if [ -z "${ROCM_PATCH}" ] || [ "${ROCM_PATCH}" = "0" ]; then \
ROCM_PATCH=0 && \
ROCM_VERSION=$(echo "${ROCM_VERSION}" | sed 's/\.0$//') \
; fi && \
ROCM_VERSN=$(( ("${ROCM_MAJOR}"*10000)+("${ROCM_MINOR}"*100) + ("${ROCM_PATCH}"))) && \
AMDGPU_DEB="amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb" && \
wget https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/ubuntu/${OS_CODENAME}/${AMDGPU_DEB} && \
apt-get install -y ./${AMDGPU_DEB} && \
apt-get update && \
apt-get install -y rocm-dev rccl-dev libpciaccess0 ${EXTRA_PACKAGES} && \
apt-get autoclean; \
fi
ARG PYTHON_VERSIONS="6 7 8 9 10 11 12 13"
RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh && \
bash miniforge.sh -b -p /opt/conda && \
export PATH="/opt/conda/bin:${PATH}" && \
conda config --set always_yes yes --set changeps1 no --set solver classic && \
conda update -c conda-forge -n base conda && \
for i in ${PYTHON_VERSIONS}; do conda create -n py3.${i} -c conda-forge python=3.${i} pip; done && \
for i in ${PYTHON_VERSIONS}; do /opt/conda/envs/py3.${i}/bin/python -m pip install numpy perfetto dataclasses; done && \
conda clean -a -y && \
conda init
ENV LC_ALL=C.UTF-8
WORKDIR /home
SHELL [ "/bin/bash", "--login", "-c" ]