FROM openshift/golang-builder:1.13 AS builder
ENV __doozer=update BUILD_RELEASE=202102040041.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202102040041.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=45d9a1a546bd435f79115b458c66e27c5ecae1b0 KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=13+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.13.0+45d9a1a OS_GIT_COMMIT=45d9a1a OS_GIT_VERSION=4.5.0-202102040041.p0-45d9a1a SOURCE_DATE_EPOCH=1612397846 SOURCE_GIT_COMMIT=45d9a1a546bd435f79115b458c66e27c5ecae1b0 SOURCE_GIT_TAG=v4.0.0-168-g45d9a1a54 SOURCE_GIT_URL=https://github.com/openshift/builder 
WORKDIR /go/src/github.com/openshift/builder
COPY . .
RUN hack/build.sh

FROM openshift/ose-base:ubi7
ENV __doozer=update BUILD_RELEASE=202102040041.p0 BUILD_VERSION=v4.5.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=5 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.5.0-202102040041.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge KUBE_GIT_COMMIT=45d9a1a546bd435f79115b458c66e27c5ecae1b0 KUBE_GIT_MAJOR=1 KUBE_GIT_MINOR=13+ KUBE_GIT_TREE_STATE=clean KUBE_GIT_VERSION=v1.13.0+45d9a1a OS_GIT_COMMIT=45d9a1a OS_GIT_VERSION=4.5.0-202102040041.p0-45d9a1a SOURCE_DATE_EPOCH=1612397846 SOURCE_GIT_COMMIT=45d9a1a546bd435f79115b458c66e27c5ecae1b0 SOURCE_GIT_TAG=v4.0.0-168-g45d9a1a54 SOURCE_GIT_URL=https://github.com/openshift/builder 
# TODO: Add fuse-overlayfs once we build off of RHEL-8 UBI
RUN INSTALL_PKGS=" \
      bind-utils bsdtar findutils git hostname lsof runc socat \
      sysvinit-tools tar tree util-linux wget which \
      " && \
    yum install -y --setopt=skip_missing_names_on_install=False $INSTALL_PKGS && \
    yum clean all
COPY --from=builder /go/src/github.com/openshift/builder/openshift-builder /usr/bin/
COPY imagecontent/policy.json /etc/containers/
COPY imagecontent/registries.conf /etc/containers/
COPY imagecontent/storage.conf /etc/containers/
COPY imagecontent/usr/share/containers /usr/share/containers
RUN mkdir -p /var/cache/blobs \
    /var/lib/shared/overlay-images \
    /var/lib/shared/overlay-layers && \
    touch /var/lib/shared/overlay-images/images.lock \
    /var/lib/shared/overlay-layers/layers.lock

RUN ln -s /usr/bin/openshift-builder /usr/bin/openshift-sti-build && \
    ln -s /usr/bin/openshift-builder /usr/bin/openshift-docker-build && \
    ln -s /usr/bin/openshift-builder /usr/bin/openshift-git-clone && \
    ln -s /usr/bin/openshift-builder /usr/bin/openshift-manage-dockerfile && \
    ln -s /usr/bin/openshift-builder /usr/bin/openshift-extract-image-content

LABEL \
        io.k8s.display-name="OpenShift Container Platform Container Builder" \
        io.k8s.description="This is a component of OpenShift Container Platform and is responsible for executing container image builds." \
        io.openshift.tags="openshift,builder" \
        License="GPLv2+" \
        vendor="Red Hat" \
        name="openshift/ose-docker-builder" \
        com.redhat.component="openshift-enterprise-builder-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Build" \
        release="202102040041.p0" \
        io.openshift.build.commit.id="45d9a1a546bd435f79115b458c66e27c5ecae1b0" \
        io.openshift.build.source-location="https://github.com/openshift/builder" \
        io.openshift.build.commit.url="https://github.com/openshift/builder/commit/45d9a1a546bd435f79115b458c66e27c5ecae1b0" \
        version="v4.5.0"

