FROM openshift/golang-builder:rhel_8_golang_1.16 AS builder
ENV __doozer=update BUILD_RELEASE=202110182323.p0.git.ed0b846.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202110182323.p0.git.ed0b846.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=ed0b846 OS_GIT_VERSION=4.9.0-202110182323.p0.git.ed0b846.assembly.stream-ed0b846 SOURCE_DATE_EPOCH=1627568303 SOURCE_GIT_COMMIT=ed0b846c056056848f0ab7741bd3f1254e1862d6 SOURCE_GIT_TAG=ed0b846 SOURCE_GIT_URL=https://github.com/openshift/network-tools 
WORKDIR /go/src/github.com/openshift/network-tools
COPY . .

# needed for ovnkube-trace
FROM openshift/ose-ovn-kubernetes:v4.9.0.20211018.233142 AS ovnkube-trace
ENV __doozer=update BUILD_RELEASE=202110182323.p0.git.ed0b846.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202110182323.p0.git.ed0b846.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=ed0b846 OS_GIT_VERSION=4.9.0-202110182323.p0.git.ed0b846.assembly.stream-ed0b846 SOURCE_DATE_EPOCH=1627568303 SOURCE_GIT_COMMIT=ed0b846c056056848f0ab7741bd3f1254e1862d6 SOURCE_GIT_TAG=ed0b846 SOURCE_GIT_URL=https://github.com/openshift/network-tools 

# tools (openshift-tools) is based off cli
FROM openshift/ose-tools:v4.9.0.20211018.233142
ENV __doozer=update BUILD_RELEASE=202110182323.p0.git.ed0b846.assembly.stream BUILD_VERSION=v4.9.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=9 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.9.0-202110182323.p0.git.ed0b846.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=ed0b846 OS_GIT_VERSION=4.9.0-202110182323.p0.git.ed0b846.assembly.stream-ed0b846 SOURCE_DATE_EPOCH=1627568303 SOURCE_GIT_COMMIT=ed0b846c056056848f0ab7741bd3f1254e1862d6 SOURCE_GIT_TAG=ed0b846 SOURCE_GIT_URL=https://github.com/openshift/network-tools 
COPY --from=builder /go/src/github.com/openshift/network-tools/debug-scripts/* /usr/bin/
COPY --from=ovnkube-trace /usr/bin/ovnkube-trace /usr/bin/

# Make sure to maintain alphabetical ordering when adding new packages.
RUN INSTALL_PKGS="\
    nginx \
    numactl \
    traceroute \
    wireshark \
    conntrack-tools \
    perf \
    iproute \
    " && \
    yum -y install --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False $INSTALL_PKGS && \
    yum clean all && rm -rf /var/cache/*

LABEL \
        name="openshift/ose-network-tools" \
        com.redhat.component="ose-network-tools-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Networking" \
        release="202110182323.p0.git.ed0b846.assembly.stream" \
        io.openshift.build.commit.id="ed0b846c056056848f0ab7741bd3f1254e1862d6" \
        io.openshift.build.source-location="https://github.com/openshift/network-tools" \
        io.openshift.build.commit.url="https://github.com/openshift/network-tools/commit/ed0b846c056056848f0ab7741bd3f1254e1862d6" \
        version="v4.9.0"

