Repository navigation
Expand file tree
/
Copy pathrocm_runtime.Dockerfile
More file actions
250 lines (242 loc) · 9.52 KB
/
Copy pathrocm_runtime.Dockerfile
File metadata and controls
250 lines (242 loc) · 9.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# rocm_runtime.Dockerfile
#
# ROCm Runtime Docker Image Builder
# - Single Dockerfile supporting multiple Linux distributions via `BASE_IMAGE`.
#
# Maintained by: AMD ROCm Engineering (contact: dl.MLSE.DevOps@amd.com)
#
# Support policy:
# - Intended for evaluation and development workflows.
# - Nightlies/prereleases/devreleases are subject to change and may be removed or temporarily unavailable.
#
# Trademark:
# - ROCm is a trademark of Advanced Micro Devices, Inc.
#
# Compliance note:
# - This Dockerfile downloads ROCm tarballs or deb/rpm packages during `docker build` and installs OS packages from the selected base image.
# - If you redistribute a resulting image, you are responsible for ensuring compliance with applicable licenses/terms
# for (1) downloaded ROCm artifacts and (2) the base OS packages you install.
#
# Supply-chain / reproducibility note:
# - For production or CI reproducibility, pin `BASE_IMAGE` by digest (e.g., ubuntu@sha256:...).
#
# Runtime note:
# - This is a user-space ROCm runtime image. It does NOT include kernel drivers.
# - Host must provide compatible AMDGPU/ROCm kernel components and device access (e.g., --device=/dev/kfd --device=/dev/dri).
# - Typical run flags: --device=/dev/kfd --device=/dev/dri (and often appropriate group/permission settings).
#
# Supported base images (examples)
# - ubuntu:24.04
# - debian:12 (Bookworm)
# - debian:13 (Trixie)
# - almalinux:8
# - mcr.microsoft.com/azurelinux/base/core:3.0
# - registry.access.redhat.com/ubi8/ubi:8.10 (RHEL 8.10)
# - registry.access.redhat.com/ubi9/ubi:9.7 (RHEL 9.7)
# - registry.access.redhat.com/ubi10/ubi:10.1 (RHEL 10.1)
# - registry.suse.com/bci/bci-base:15.7 (SLES 15.7)
# - registry.suse.com/bci/bci-base:16.0 (SLES 16.0)
#
# Build arguments
# - BASE_IMAGE : Base Docker image (default: ubuntu:24.04)
# - VERSION : Full version string (e.g., 7.11.0a20251211, 7.10.0)
# - AMDGPU_FAMILY : AMD GPU family (e.g., gfx110X-all, gfx94X-dcgpu).
# Use 'multi-arch' to install AMD's all-GPU artifact in
# a single image (works with both INSTALL_METHOD=packages
# and INSTALL_METHOD=tarball).
# - RELEASE_TYPE : Release type (default: nightlies). Options: prereleases, devreleases, stable
# Note: devreleases is only supported with INSTALL_METHOD=tarball.
# - INSTALL_METHOD : Installation method (default: tarball). Options: tarball, packages
#
# Build examples (tarball, default):
#
# # Ubuntu 24.04 + gfx110X (nightly)
# docker build \
# --build-arg BASE_IMAGE=ubuntu:24.04 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx110X-all \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:ubuntu24.04-gfx110X-7.11.0a20251211 \
# dockerfiles/
#
# # AlmaLinux 8 + gfx94X (nightly)
# docker build \
# --build-arg BASE_IMAGE=almalinux:8 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx94X-dcgpu \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:almalinux8-gfx94X-7.11.0a20251211 \
# dockerfiles/
#
# # Azure Linux 3 + gfx120X (nightly)
# docker build \
# --build-arg BASE_IMAGE=mcr.microsoft.com/azurelinux/base/core:3.0 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx120X-all \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:azurelinux3-gfx120X-7.11.0a20251211 \
# dockerfiles/
#
# # Ubuntu 22.04 + gfx94X (stable release)
# docker build \
# --build-arg BASE_IMAGE=ubuntu:22.04 \
# --build-arg VERSION=7.10.0 \
# --build-arg AMDGPU_FAMILY=gfx94X-dcgpu \
# --build-arg RELEASE_TYPE=stable \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm:ubuntu22.04-gfx94X-7.10.0 \
# dockerfiles/
#
# # Debian 12 + gfx110x via packages (stable)
# docker build \
# --build-arg BASE_IMAGE=debian:12 \
# --build-arg VERSION=7.13.0 \
# --build-arg AMDGPU_FAMILY=gfx110x \
# --build-arg RELEASE_TYPE=stable \
# --build-arg INSTALL_METHOD=packages \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm:debian12-gfx110x-7.13.0 \
# dockerfiles/
#
# # Debian 13 + multi-arch via packages (stable)
# docker build \
# --build-arg BASE_IMAGE=debian:13 \
# --build-arg VERSION=7.13.0 \
# --build-arg AMDGPU_FAMILY=multi-arch \
# --build-arg RELEASE_TYPE=stable \
# --build-arg INSTALL_METHOD=packages \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm:debian13-multi-arch-7.13.0 \
# dockerfiles/
#
# # RHEL 8.10 UBI + gfx94X (nightly)
# docker build \
# --build-arg BASE_IMAGE=registry.access.redhat.com/ubi8/ubi:8.10 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx94X-dcgpu \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:rhel8.10-gfx94X-7.11.0a20251211 \
# dockerfiles/
#
# # RHEL 9.7 UBI + gfx94X (nightly)
# docker build \
# --build-arg BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.7 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx94X-dcgpu \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:rhel9.7-gfx94X-7.11.0a20251211 \
# dockerfiles/
#
# # RHEL 10.1 UBI + gfx110X (nightly)
# docker build \
# --build-arg BASE_IMAGE=registry.access.redhat.com/ubi10/ubi:10.1 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx110X-all \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:rhel10.1-gfx110X-7.11.0a20251211 \
# dockerfiles/
#
# # SLES 15.7 BCI + gfx110X (nightly)
# docker build \
# --build-arg BASE_IMAGE=registry.suse.com/bci/bci-base:15.7 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx110X-all \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:sles15.7-gfx110X-7.11.0a20251211 \
# dockerfiles/
#
# # SLES 16.0 BCI + gfx94X (nightly)
# docker build \
# --build-arg BASE_IMAGE=registry.suse.com/bci/bci-base:16.0 \
# --build-arg VERSION=7.11.0a20251211 \
# --build-arg AMDGPU_FAMILY=gfx94X-dcgpu \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly:sles16.0-gfx94X-7.11.0a20251211 \
# dockerfiles/
#
# Build examples (packages):
#
# # Ubuntu 24.04 + gfx110x via packages (nightly)
# docker build \
# --build-arg BASE_IMAGE=ubuntu:24.04 \
# --build-arg VERSION=7.13.0a20260322 \
# --build-arg AMDGPU_FAMILY=gfx110x \
# --build-arg INSTALL_METHOD=packages \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly-pkg:ubuntu24.04-gfx110x-7.13.0a20260322 \
# dockerfiles/
#
# # RHEL 9.7 UBI + gfx94x via packages (nightly)
# docker build \
# --build-arg BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.7 \
# --build-arg VERSION=7.13.0a20260322 \
# --build-arg AMDGPU_FAMILY=gfx94x \
# --build-arg INSTALL_METHOD=packages \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly-pkg:rhel9.7-gfx94x-7.13.0a20260322 \
# dockerfiles/
#
# # Ubuntu 24.04 + all GPU families via multi-arch packages (nightly)
# docker build \
# --build-arg BASE_IMAGE=ubuntu:24.04 \
# --build-arg VERSION=7.13.0a20260322 \
# --build-arg AMDGPU_FAMILY=multi-arch \
# --build-arg INSTALL_METHOD=packages \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly-pkg:ubuntu24.04-multi-arch-7.13.0a20260322 \
# dockerfiles/
#
# # Ubuntu 24.04 + all GPU families via multi-arch tarball (nightly)
# docker build \
# --build-arg BASE_IMAGE=ubuntu:24.04 \
# --build-arg VERSION=7.13.0a20260515 \
# --build-arg AMDGPU_FAMILY=multi-arch \
# --build-arg INSTALL_METHOD=tarball \
# -f dockerfiles/rocm_runtime.Dockerfile \
# -t rocm-nightly-tar:ubuntu24.04-multi-arch-7.13.0a20260515 \
# dockerfiles/
#
# Run example:
# docker run --rm -it --device=/dev/kfd --device=/dev/dri \
# --security-opt seccomp=unconfined \
# rocm-nightly:ubuntu24.04-gfx110X-7.11.0a20251211 rocminfo
# Base image selection
ARG BASE_IMAGE=ubuntu:24.04
FROM ${BASE_IMAGE}
# ROCm configuration arguments
ARG VERSION
ARG AMDGPU_FAMILY
ARG RELEASE_TYPE=nightlies
ARG INSTALL_METHOD=tarball
LABEL org.opencontainers.image.title="ROCm runtime image (TheRock)" \
org.opencontainers.image.description="ROCm user-space runtime image built from TheRock project; installs ROCm from prebuilt tarballs or packages during build." \
org.opencontainers.image.version="${VERSION}"
# Copy installation scripts
COPY install_rocm_deps.sh /tmp/
COPY install_rocm_tarball.sh /tmp/
COPY install_rocm_packages.sh /tmp/
# Install system dependencies
# The script auto-detects the distribution and uses the appropriate package manager
RUN chmod +x /tmp/install_rocm_deps.sh && \
/tmp/install_rocm_deps.sh
# Install ROCm via tarball or packages based on INSTALL_METHOD
RUN chmod +x /tmp/install_rocm_tarball.sh /tmp/install_rocm_packages.sh && \
if [ "${INSTALL_METHOD}" = "packages" ]; then \
/tmp/install_rocm_packages.sh \
"${VERSION}" \
"${AMDGPU_FAMILY}" \
"${RELEASE_TYPE}"; \
else \
/tmp/install_rocm_tarball.sh \
"${VERSION}" \
"${AMDGPU_FAMILY}" \
"${RELEASE_TYPE}"; \
fi && \
rm -f /tmp/install_rocm_deps.sh /tmp/install_rocm_tarball.sh /tmp/install_rocm_packages.sh
# Configure environment variables
ENV ROCM_PATH=/opt/rocm
ENV PATH="/opt/rocm/bin:${PATH}"
# The runtime supports base images without a common user-management package and
# relies on root for direct access to host-provided GPU device nodes.
# trivy:ignore:DS-0002
USER root