FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=a8140cc16f57414529bde1d8a010ec6a4292bead SOURCE_DATE_EPOCH=1571716017 BUILD_VERSION=v4.2.8 SOURCE_GIT_URL=https://github.com/openshift/sdn SOURCE_GIT_TAG=v0.0.0-alpha.0-55-ga8140cc1 BUILD_RELEASE=201911190952
WORKDIR /go/src/github.com/openshift/sdn
COPY . .
RUN make build --warn-undefined-variables

FROM openshift/ose-base:v4.2.8.20191119.095254
ENV SOURCE_GIT_COMMIT=a8140cc16f57414529bde1d8a010ec6a4292bead SOURCE_DATE_EPOCH=1571716017 BUILD_VERSION=v4.2.8 SOURCE_GIT_URL=https://github.com/openshift/sdn SOURCE_GIT_TAG=v0.0.0-alpha.0-55-ga8140cc1 BUILD_RELEASE=201911190952
RUN INSTALL_PKGS="conntrack-tools" && \
    yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
    yum clean all && rm -rf /var/cache/*

COPY --from=builder /go/src/github.com/openshift/sdn/kube-proxy /usr/bin/
COPY ./images/iptables-scripts/iptables /usr/sbin/
COPY ./images/iptables-scripts/iptables-save /usr/sbin/
COPY ./images/iptables-scripts/iptables-restore /usr/sbin/
COPY ./images/iptables-scripts/ip6tables /usr/sbin/
COPY ./images/iptables-scripts/ip6tables-save /usr/sbin/
COPY ./images/iptables-scripts/ip6tables-restore /usr/sbin/

LABEL \
        io.k8s.description="Provides kube-proxy for external CNI plugins" \
        com.redhat.component="kube-proxy-container" \
        name="openshift/ose-kube-proxy" \
        io.k8s.display-name="Kubernetes kube-proxy" \
        io.openshift.build.source-location="https://github.com/openshift/sdn" \
        io.openshift.build.commit.url="https://github.com/openshift/sdn/commit/a8140cc16f57414529bde1d8a010ec6a4292bead" \
        version="v4.2.8" \
        io.openshift.build.commit.id="a8140cc16f57414529bde1d8a010ec6a4292bead" \
        release="201911190952" \
        io.openshift.tags="openshift,kube-proxy"

