Skip to content
Open
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
34 changes: 2 additions & 32 deletions Dockerfile.openshift
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
# This dockerfile is specific to building Multus for OpenShift
# rhel10 golang builders don't exist yet, so use rhel9 for now
# replace with rhel10 golang builder when it is released
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS rhel10
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
ENV CGO_ENABLED=1
ENV GO111MODULE=off
ENV VERSION=rhel10 COMMIT=unset
RUN ./hack/build-go.sh && \
cd /usr/src/multus-cni/bin
WORKDIR /

FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS rhel9
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
Expand All @@ -21,29 +9,11 @@ RUN ./hack/build-go.sh && \
cd /usr/src/multus-cni/bin
WORKDIR /

FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.25-openshift-4.22 AS rhel8
ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni
ENV CGO_ENABLED=1
ENV GO111MODULE=off
ENV VERSION=rhel8 COMMIT=unset
RUN ./hack/build-go.sh && \
cd /usr/src/multus-cni/bin
WORKDIR /

FROM registry.ci.openshift.org/ocp/4.22:base-rhel9
RUN dnf install -y util-linux && dnf clean all && \
mkdir -p /usr/src/multus-cni/images && \
mkdir -p /usr/src/multus-cni/bin && \
mkdir -p /usr/src/multus-cni/rhel10/bin && \
mkdir -p /usr/src/multus-cni/rhel9/bin && \
mkdir -p /usr/src/multus-cni/rhel8/bin
COPY --from=rhel10 /usr/src/multus-cni/bin /usr/src/multus-cni/rhel10/bin
COPY --from=rhel9 /usr/src/multus-cni/bin /usr/src/multus-cni/rhel9/bin
COPY --from=rhel8 /usr/src/multus-cni/bin /usr/src/multus-cni/rhel8/bin
# copy container base image binary to /usr/src/multus-cni/bin
RUN bash -c '. /etc/os-release; \
cp /usr/src/multus-cni/rhel$(echo "${VERSION_ID}" | cut -f 1 -d .)/bin/* /usr/src/multus-cni/bin'
mkdir -p /usr/src/multus-cni/bin
COPY --from=rhel9 /usr/src/multus-cni/bin /usr/src/multus-cni/bin
ADD ./images/entrypoint.sh /

LABEL io.k8s.display-name="Multus CNI" \
Expand Down
3 changes: 2 additions & 1 deletion hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ fi
# Add version/commit/date into binary
DATE=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --iso-8601=seconds)
COMMIT=${COMMIT:-$(git rev-parse --verify HEAD)}
LDFLAGS="-X gopkg.in/k8snetworkplumbingwg/multus-cni.v4/pkg/multus.version=${VERSION} \
LDFLAGS="-s -w \
-X gopkg.in/k8snetworkplumbingwg/multus-cni.v4/pkg/multus.version=${VERSION} \
-X gopkg.in/k8snetworkplumbingwg/multus-cni.v4/pkg/multus.commit=${COMMIT} \
-X gopkg.in/k8snetworkplumbingwg/multus-cni.v4/pkg/multus.gitTreeState=${GIT_TREE_STATE} \
-X gopkg.in/k8snetworkplumbingwg/multus-cni.v4/pkg/multus.releaseStatus=${RELEASE_STATUS} \
Expand Down