| 1 |
# Use rocm/dev-ubuntu-22.04 as the base image |
| 2 |
FROM rocm/dev-ubuntu-22.04 |
| 3 |
|
| 4 |
# Set environment variables for build directories and package patterns |
| 5 |
ENV BUILD_FOLDER=/home/amdsmi/build |
| 6 |
ENV DEB_BUILD="amd-smi-lib*99999-local_amd64.deb" |
| 7 |
ENV DEB_BUILD_TEST="amd-smi-lib-tests*99999-local_amd64.deb" |
| 8 |
|
| 9 |
# Set the working directory to /home |
| 10 |
WORKDIR /home |
| 11 |
|
| 12 |
# Install necessary system packages |
| 13 |
RUN apt update && apt-get install -y git build-essential rpm pkg-config g++ python3 python3-pip python3-wheel python3-setuptools |
| 14 |
|
| 15 |
# Upgrade pip and install cmake and virtualenv using pip |
| 16 |
RUN python3 -m pip install --upgrade pip setuptools && \ |
| 17 |
python3 -m pip install cmake virtualenv |
| 18 |
|
| 19 |
# Clone the AMD SMI repository from GitHub |
| 20 |
RUN git clone -b amd-mainline https://github.com/ROCm/amdsmi.git |
| 21 |
|
| 22 |
# Navigate to the amdsmi directory |
| 23 |
WORKDIR /home/amdsmi |
| 24 |
|
| 25 |
# Build and Install AMDSMI |
| 26 |
RUN rm -rf ${BUILD_FOLDER} && \ |
| 27 |
mkdir -p ${BUILD_FOLDER} && \ |
| 28 |
cd ${BUILD_FOLDER} && \ |
| 29 |
cmake .. -DBUILD_TESTS=ON -DENABLE_ESMI_LIB=ON && \ |
| 30 |
make -j $(nproc) VERBOSE=1 && \ |
| 31 |
make package && \ |
| 32 |
sudo apt install -y --allow-downgrades ${BUILD_FOLDER}/${DEB_BUILD} && \ |
| 33 |
sudo ln -s /opt/rocm/bin/amd-smi /usr/local/bin |
| 34 |
|
| 35 |
# Verify the installation of Python packages related to AMD SMI |
| 36 |
RUN python3 -m pip list | grep -E "amd|pip|setuptools" |
| 37 |
|
| 38 |
# Set the entrypoint to bash for interactive use |
| 39 |
ENTRYPOINT ["/bin/bash"] |