Skip to content

[Docker] Add dstackai/amd-smi image #2611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/docker-amd-smi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build AMD SMI Docker image

on:
workflow_dispatch:
inputs:
image_name:
description: "Docker image name"
required: true
default: "dstackai/amd-smi"
rocm_version:
description: "ROCm version"
required: true
default: "6.4"
dstack_revision:
description: "Docker image revision"
required: true
default: 0

jobs:
build-amd-smi:
defaults:
run:
working-directory: docker/amd-smi
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and upload to DockerHub
run: |
IMAGE_NAME=${{ inputs.image_name }}
docker buildx build . \
--load \
--provenance=false \
--platform linux/amd64 \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg UBUNTU_VERSION=noble \
--build-arg ROCM_VERSION=${{ inputs.rocm_version }} \
--build-arg DSTACK_REVISION=${{ inputs.dstack_revision }} \
--build-arg BUILD_DATE=$(date --utc --iso-8601=seconds)Z \
--tag ${IMAGE_NAME}:latest
VERSION=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' ${IMAGE_NAME})
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION}
docker push ${IMAGE_NAME}:${VERSION}
docker push ${IMAGE_NAME}:latest
30 changes: 30 additions & 0 deletions docker/amd-smi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG UBUNTU_VERSION

FROM ubuntu:${UBUNTU_VERSION}

ARG IMAGE_NAME
ARG UBUNTU_VERSION
ARG ROCM_VERSION
ARG DSTACK_REVISION
ARG BUILD_DATE

ENV PATH="/opt/rocm/bin:${PATH}"

RUN \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends wget ca-certificates && \
base_url="https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/ubuntu/${UBUNTU_VERSION}/" && \
deb_name=$(wget -qO- "${base_url}" | grep -Po '(?<=href=")amdgpu-install_[^"]+') && \
wget -O amdgpu-install.deb "${base_url}${deb_name}" && \
apt-get install -y --no-install-recommends ./amdgpu-install.deb && \
rm ./amdgpu-install.deb && \
apt-get update && \
apt-get install -y amd-smi-lib

ENTRYPOINT ["/opt/rocm/bin/amd-smi"]
CMD ["--help"]

LABEL org.opencontainers.image.title="${IMAGE_NAME}"
LABEL org.opencontainers.image.version="${ROCM_VERSION}-${DSTACK_REVISION}"
LABEL org.opencontainers.image.created="${BUILD_DATE}"
9 changes: 9 additions & 0 deletions docker/amd-smi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# dstack AMD SMI

An Ubuntu-based image with [AMD SMI](https://rocm.docs.amd.com/projects/amdsmi/en/latest/) preinstalled. Suitable for AMD GPU detection.

## Usage

```shell
docker run --rm --device /dev/kfd --device /dev/dri dstackai/amd-smi static
```
Loading