FROM openshift/golang-builder:rhel_8_golang_1.12 AS builder
ENV __doozer=update BUILD_RELEASE=202104250659.p0 BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202104250659.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=45b6800 OS_GIT_VERSION=4.7.0-202104250659.p0-45b6800 SOURCE_DATE_EPOCH=1618036833 SOURCE_GIT_COMMIT=45b6800c4fab213e7afee1e406abe48cc14ee020 SOURCE_GIT_TAG=v3.4.9-470-g45b6800c4 SOURCE_GIT_URL=https://github.com/openshift/etcd 

WORKDIR /go/src/go.etcd.io/etcd

COPY . .

RUN ./build

# stage 2
FROM openshift/ose-base:v4.7.0.20210425.073610
ENV __doozer=update BUILD_RELEASE=202104250659.p0 BUILD_VERSION=v4.7.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=7 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.7.0-202104250659.p0 SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=45b6800 OS_GIT_VERSION=4.7.0-202104250659.p0-45b6800 SOURCE_DATE_EPOCH=1618036833 SOURCE_GIT_COMMIT=45b6800c4fab213e7afee1e406abe48cc14ee020 SOURCE_GIT_TAG=v3.4.9-470-g45b6800c4 SOURCE_GIT_URL=https://github.com/openshift/etcd 

ENTRYPOINT ["/usr/bin/etcd"]

COPY --from=builder /go/src/go.etcd.io/etcd/bin/etcd /usr/bin/
COPY --from=builder /go/src/go.etcd.io/etcd/bin/etcdctl /usr/bin/
COPY --from=builder /go/src/go.etcd.io/etcd/bin/discover-etcd-initial-cluster /usr/bin/

LABEL \
        io.k8s.display-name="etcd server" \
        io.k8s.description="etcd is distributed key-value store which stores the persistent master state for Kubernetes and OpenShift." \
        maintainer="Sam Batschelet <sbatsche@redhat.com>" \
        License="Apache 2.0" \
        io.openshift.tags="etcd" \
        name="openshift/ose-etcd" \
        com.redhat.component="ose-etcd-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        release="202104250659.p0" \
        io.openshift.build.commit.id="45b6800c4fab213e7afee1e406abe48cc14ee020" \
        io.openshift.build.source-location="https://github.com/openshift/etcd" \
        io.openshift.build.commit.url="https://github.com/openshift/etcd/commit/45b6800c4fab213e7afee1e406abe48cc14ee020" \
        version="v4.7.0"

