#
# This Dockerfile builds the development image of network-tools repo.
#
# NOTE:
#
# This image is only for development environment, so please DO NOT DEPLOY
# this image in any production environment.
#

FROM registry.ci.openshift.org/openshift/release:golang-1.15 AS builder
WORKDIR /go/src/github.com/openshift/network-tools
COPY . .

FROM fedora:32
COPY --from=builder /go/src/github.com/openshift/network-tools/debug-scripts/* /usr/bin/
RUN yum -y --setopt=tsflags=nodocs install git go nginx jq tcpdump traceroute wireshark net-tools nmap-ncat pciutils strace numactl make && \
    yum clean all && rm -rf /var/cache/* && \
    curl https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/4.6.0/openshift-client-linux-4.6.0.tar.gz > /tmp/oc.tar.gz && \
    tar xzvf /tmp/oc.tar.gz -C /usr/bin && \
    rm /tmp/oc.tar.gz && \
    # needed for ovnkube-trace
    git clone https://github.com/openshift/ovn-kubernetes.git /usr/bin/ovn-kubernetes && \
    pushd /usr/bin/ovn-kubernetes/go-controller && hack/build-go.sh cmd/ovnkube-trace && \
    mv _output/go/bin/ovnkube-trace /usr/bin/ovnkube-trace && popd && \
    rm -rf /usr/bin/ovn-kubernetes