FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=6e937ad0e68e31a668ec50ae9e5736b787ebe902 SOURCE_DATE_EPOCH=1574953065 BUILD_VERSION=v4.2.10 SOURCE_GIT_URL=https://github.com/openshift/sdn SOURCE_GIT_TAG=v0.0.0-alpha.0-59-g6e937ad0 BUILD_RELEASE=201912022352
WORKDIR /go/src/github.com/openshift/sdn
COPY . .
RUN make build --warn-undefined-variables

FROM openshift/ose-base:v4.2.10.20191202.235209
ENV SOURCE_GIT_COMMIT=6e937ad0e68e31a668ec50ae9e5736b787ebe902 SOURCE_DATE_EPOCH=1574953065 BUILD_VERSION=v4.2.10 SOURCE_GIT_URL=https://github.com/openshift/sdn SOURCE_GIT_TAG=v0.0.0-alpha.0-59-g6e937ad0 BUILD_RELEASE=201912022352
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/6e937ad0e68e31a668ec50ae9e5736b787ebe902" \
        version="v4.2.10" \
        io.openshift.build.commit.id="6e937ad0e68e31a668ec50ae9e5736b787ebe902" \
        release="201912022352" \
        io.openshift.tags="openshift,kube-proxy"

