FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.12 AS builder
WORKDIR /go/src/github.com/openshift/sdn
COPY . .
RUN make build --warn-undefined-variables

FROM registry.svc.ci.openshift.org/ocp/4.2:base
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.display-name="Kubernetes kube-proxy" \
      io.k8s.description="Provides kube-proxy for external CNI plugins" \
      io.openshift.tags="openshift,kube-proxy"
