forked from Mellanox/nic-configuration-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.nic-configuration-daemon
56 lines (46 loc) · 2.49 KB
/
Dockerfile.nic-configuration-daemon
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
# Build the manager binary
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH
ARG GCFLAGS
WORKDIR /workspace
# Copy sources
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN --mount=type=cache,target=/go/pkg/mod/ go mod download
# Copy the go source
COPY ./ ./
# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN --mount=type=cache,target=/go/pkg/mod/ GO_GCFLAGS=${GCFLAGS} make build-daemon
FROM quay.io/centos/centos:stream9
ARG TARGETARCH
ENV RHEL_VERSION=9.4
ENV OFED_PACKAGE_MAJOR_VERSION=24.07
ENV OFED_PACKAGE_MINOR_VERSION=0.6.1.0
ENV MFT_VERSION=4.29.0-131
ENV MLNX_TOOLS_VERSION=0.2407061
RUN yum -y install hwdata mstflint wget pciutils procps-ng kmod systemd && yum clean all
RUN ARCH_SUFFIX="${TARGETARCH}" \
&& ARCH_SUFFIX="${ARCH_SUFFIX//amd64/x86_64}" \
&& ARCH_SUFFIX="${ARCH_SUFFIX//arm64/aarch64}" \
&& wget https://linux.mellanox.com/public/repo/mlnx_ofed/${OFED_PACKAGE_MAJOR_VERSION}-${OFED_PACKAGE_MINOR_VERSION}/rhel${RHEL_VERSION}/${ARCH_SUFFIX}/mlnx-tools-${OFED_PACKAGE_MAJOR_VERSION}-${MLNX_TOOLS_VERSION}.${ARCH_SUFFIX}.rpm \
&& rpm -i mlnx-tools-${OFED_PACKAGE_MAJOR_VERSION}-${MLNX_TOOLS_VERSION}.${ARCH_SUFFIX}.rpm \
&& rm mlnx-tools-${OFED_PACKAGE_MAJOR_VERSION}-${MLNX_TOOLS_VERSION}.${ARCH_SUFFIX}.rpm
RUN ARCH_SUFFIX1="${TARGETARCH}" \
&& ARCH_SUFFIX1="${ARCH_SUFFIX1//amd64/x86_64}" \
&& ARCH_SUFFIX1="${ARCH_SUFFIX1//arm64/aarch64}" \
&& ARCH_SUFFIX2="${TARGETARCH}" \
&& ARCH_SUFFIX2="${ARCH_SUFFIX2//amd64/x86_64}" \
&& wget https://linux.mellanox.com/public/repo/mlnx_ofed/${OFED_PACKAGE_MAJOR_VERSION}-${OFED_PACKAGE_MINOR_VERSION}/rhel${RHEL_VERSION}/${ARCH_SUFFIX1}/mft-${MFT_VERSION}.${ARCH_SUFFIX2}.rpm \
&& rpm -i mft-${MFT_VERSION}.${ARCH_SUFFIX2}.rpm \
&& rm mft-${MFT_VERSION}.${ARCH_SUFFIX2}.rpm
WORKDIR /
COPY --from=builder /workspace/build/nic-configuration-daemon .
ENTRYPOINT ["/nic-configuration-daemon"]
LABEL org.opencontainers.image.source=https://github.com/Mellanox/nic-configuration-daemon