-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathContainerfile.gkm-agent
More file actions
84 lines (71 loc) · 2.16 KB
/
Containerfile.gkm-agent
File metadata and controls
84 lines (71 loc) · 2.16 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
# 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
# Use a minimal Ubuntu base image that supports CGO binaries
FROM public.ecr.aws/docker/library/ubuntu:24.04
# Copy the binary from the builder
COPY --from=builder /workspace/bin/gkm-agent /agent
# Install required runtime libraries for CGO
RUN apt-get update && \
apt-get install -y \
ca-certificates \
libgpgme11 \
libbtrfs0 \
libffi8 \
libc6 \
wget \
pciutils \
hwdata \
gnupg2 \
python3-setuptools \
python3-wheel \
curl \
dialog \
rsync \
lsb-release \
software-properties-common \
libseccomp2 && \
apt-get clean
ARG NO_GPU=false
ARG ROCM_VERSION=7.0.1
ARG AMDGPU_VERSION=7.0.1.70001
ARG OPT_ROCM_VERSION=7.0.1
# Conditionally install ROCm packages based on NO_GPU flag
RUN if [ "$NO_GPU" = "false" ]; then \
wget https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/ubuntu/noble/amdgpu-install_${AMDGPU_VERSION}-1_all.deb && \
apt install -y ./*.deb && \
apt update && DEBIAN_FRONTEND=noninteractive apt install -y amd-smi-lib rocm-smi-lib && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
ln -s /opt/rocm-${OPT_ROCM_VERSION}/bin/amd-smi /usr/bin/amd-smi && \
ln -s /opt/rocm-${OPT_ROCM_VERSION}/bin/rocm-smi /usr/bin/rocm-smi; \
else \
echo "NO_GPU=true, skipping ROCm installation"; \
fi
# Set NO_GPU environment variable
ENV NO_GPU=${NO_GPU}
# Run as non-root user
USER 65532:65532
ENTRYPOINT ["/agent"]