Skip to content

Instantly share code, notes, and snippets.

@mrunalp
Created July 10, 2023 19:20
Show Gist options
  • Save mrunalp/5d9b661e77ee803620e718e85f40c82d to your computer and use it in GitHub Desktop.
Save mrunalp/5d9b661e77ee803620e718e85f40c82d to your computer and use it in GitHub Desktop.
sdn dockerfile
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.19-openshift-4.13 AS rhel9-builder
WORKDIR /go/src/github.com/openshift/sdn
COPY . .
RUN make build --warn-undefined-variables
RUN CGO_ENABLED=1 make build GO_BUILD_PACKAGES="github.com/openshift/sdn/cmd/openshift-sdn-cni" --warn-undefined-variables
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.19-openshift-4.13 AS rhel8-builder
WORKDIR /go/src/github.com/openshift/sdn
COPY . .
RUN make build --warn-undefined-variables
RUN CGO_ENABLED=1 make build GO_BUILD_PACKAGES="github.com/openshift/sdn/cmd/openshift-sdn-cni" --warn-undefined-variables
FROM registry.ci.openshift.org/ocp/4.13:cli AS cli
FROM registry.ci.openshift.org/ocp/4.13:base
mkdir -p /opt/cni/bin/rhel9
COPY --from=rhel9-builder /go/src/github.com/openshift/sdn/openshift-sdn-cni /opt/cni/bin/rhel9/openshift-sdn
COPY --from=rhel9-builder /go/src/github.com/openshift/sdn/host-local /opt/cni/bin/rhel9/osdn-host-local
COPY --from=cli /usr/bin/oc /usr/bin/
mkdir -p /opt/cni/bin/rhel8
COPY --from=rhel8-builder /go/src/github.com/openshift/sdn/openshift-sdn-node /usr/bin/
COPY --from=rhel8-builder /go/src/github.com/openshift/sdn/openshift-sdn-controller /usr/bin/
COPY --from=rhel8-builder /go/src/github.com/openshift/sdn/openshift-sdn-cni /opt/cni/bin/rhel8/openshift-sdn
COPY --from=rhel8-builder /go/src/github.com/openshift/sdn/host-local /opt/cni/bin/rhel8/osdn-host-local
RUN INSTALL_PKGS=" \
openvswitch2.13 container-selinux socat ethtool nmap-ncat \
libmnl libnetfilter_conntrack conntrack-tools \
libnfnetlink iproute procps-ng openssl \
iputils binutils xz util-linux dbus nftables \
tcpdump iptables" && \
yum install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False $INSTALL_PKGS && \
mkdir -p /etc/sysconfig/cni/net.d && \
yum clean all && rm -rf /var/cache/*
LABEL io.k8s.display-name="OpenShift SDN" \
io.k8s.description="This is a component of OpenShift and contains the default SDN implementation." \
io.openshift.tags="openshift,sdn,sdn-controller"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment