forked from redhat-et/GKM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile.gkm-agent.unified
More file actions
78 lines (67 loc) · 2.68 KB
/
Copy pathContainerfile.gkm-agent.unified
File metadata and controls
78 lines (67 loc) · 2.68 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
# Build the agent binary
FROM public.ecr.aws/docker/library/golang:1.25 AS builder
WORKDIR /workspace
# Install required system packages
RUN apt-get update && \
apt-get install -y \
libgpgme-dev \
btrfs-progs \
libbtrfs-dev \
libgpgme11-dev \
libseccomp-dev \
pkg-config \
build-essential && \
apt-get clean
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Copy the go source
COPY agent/main.go agent/main.go
COPY api/ api/
COPY pkg/ pkg/
COPY internal/controller/ internal/controller/
COPY vendor/ vendor/
COPY Makefile Makefile
# Build the agent binary
RUN make build-gkm-agent
# NVIDIA CUDA base provides libnvidia-ml.so.1 for NVIDIA GPU detection via NVML.
# ROCm tools (amd-smi, rocm-smi) are installed for AMD GPU detection.
# A single image supports both GPU vendors; auto-detection occurs at runtime.
FROM nvcr.io/nvidia/cuda:12.6.3-base-ubuntu24.04
COPY --from=builder /workspace/bin/gkm-agent /agent
ARG TARGETARCH
ARG ROCM_VERSION=7.0.1
ARG AMDGPU_VERSION=7.0.1.70001
# Install runtime dependencies (Ubuntu 24.04 / noble package names)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libgpgme11t64 \
libbtrfs0 \
libffi8 \
libc6 \
libseccomp2 \
hwdata && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install ROCm for AMD GPU detection (amd64 only; ROCm has no arm64 packages).
# On arm64 the image still provides NVIDIA/NVML support via the CUDA base.
# Using Ubuntu 22.04 (jammy) packages as ROCm does not yet officially support Ubuntu 24.04.
RUN if [ "$TARGETARCH" = "amd64" ]; then \
apt-get update && \
apt-get install -y --no-install-recommends \
wget pciutils gnupg2 python3-setuptools python3-wheel \
curl dialog rsync lsb-release software-properties-common && \
rm -rf /var/lib/apt/lists/* && \
wget https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/ubuntu/jammy/amdgpu-install_${AMDGPU_VERSION}-1_all.deb && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y ./*.deb && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends amd-smi-lib rocm-smi-lib && \
apt-get clean && rm -rf /var/lib/apt/lists/* ./*.deb && \
ln -s /opt/rocm-${ROCM_VERSION}/bin/amd-smi /usr/bin/amd-smi && \
ln -s /opt/rocm-${ROCM_VERSION}/bin/rocm-smi /usr/bin/rocm-smi; \
fi
# Runs as root: GPU device files (/dev/kfd, /dev/dri) require group membership
# that is not available in the 65532 nonroot user; root is the practical choice
# for containers that must detect AMD/NVIDIA hardware at runtime.
ENTRYPOINT ["/agent"]