# This Dockerfile builds an image containing Mac and Linux/AMD64 versions of
# the installer layered on top of the cluster-native Linux installer image.

FROM openshift/golang-builder:rhel_8_golang_1.16 AS macbuilder
ENV __doozer=update BUILD_RELEASE=202112142229.p0.geb132da.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-202112142229.p0.geb132da.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=eb132da OS_GIT_VERSION=4.9.0-202112142229.p0.geb132da.assembly.stream-eb132da SOURCE_DATE_EPOCH=1639378768 SOURCE_GIT_COMMIT=eb132dae953888e736c382f1176c799c0e1aa49e SOURCE_GIT_TAG=unreleased-master-5011-geb132dae9 SOURCE_GIT_URL=https://github.com/openshift/installer 
ARG TAGS=""
WORKDIR /go/src/github.com/openshift/installer
COPY . .
RUN go generate ./data && \
    SKIP_GENERATION=y GOOS=darwin GOARCH=amd64 DEFAULT_ARCH="$(go env GOHOSTARCH)" GOFLAGS='-mod=vendor -p=8' hack/build.sh

FROM openshift/golang-builder:rhel_8_golang_1.16 AS linuxbuilder
ENV __doozer=update BUILD_RELEASE=202112142229.p0.geb132da.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-202112142229.p0.geb132da.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=eb132da OS_GIT_VERSION=4.9.0-202112142229.p0.geb132da.assembly.stream-eb132da SOURCE_DATE_EPOCH=1639378768 SOURCE_GIT_COMMIT=eb132dae953888e736c382f1176c799c0e1aa49e SOURCE_GIT_TAG=unreleased-master-5011-geb132dae9 SOURCE_GIT_URL=https://github.com/openshift/installer 
WORKDIR /go/src/github.com/openshift/installer
COPY . .
RUN go generate ./data && \
    SKIP_GENERATION=y GOOS=linux GOARCH=amd64 DEFAULT_ARCH="$(go env GOHOSTARCH)" GOFLAGS='-mod=vendor -p=8' hack/build.sh

FROM openshift/ose-installer:v4.9.0.20211214.225948
ENV __doozer=update BUILD_RELEASE=202112142229.p0.geb132da.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-202112142229.p0.geb132da.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=eb132da OS_GIT_VERSION=4.9.0-202112142229.p0.geb132da.assembly.stream-eb132da SOURCE_DATE_EPOCH=1639378768 SOURCE_GIT_COMMIT=eb132dae953888e736c382f1176c799c0e1aa49e SOURCE_GIT_TAG=unreleased-master-5011-geb132dae9 SOURCE_GIT_URL=https://github.com/openshift/installer 
COPY --from=macbuilder /go/src/github.com/openshift/installer/bin/openshift-install /usr/share/openshift/mac/openshift-install
COPY --from=linuxbuilder /go/src/github.com/openshift/installer/bin/openshift-install /usr/share/openshift/linux_amd64/openshift-install

LABEL \
        name="openshift/ose-installer-artifacts" \
        com.redhat.component="ose-installer-artifacts-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Installer" \
        release="202112142229.p0.geb132da.assembly.stream" \
        io.openshift.build.commit.id="eb132dae953888e736c382f1176c799c0e1aa49e" \
        io.openshift.build.source-location="https://github.com/openshift/installer" \
        io.openshift.build.commit.url="https://github.com/openshift/installer/commit/eb132dae953888e736c382f1176c799c0e1aa49e" \
        version="v4.9.0"

