FROM openshift/golang-builder@sha256:4820580c3368f320581eb9e32cf97aeec179a86c5749753a14ed76410a293d83 AS builder
ENV __doozer=update BUILD_RELEASE=202203081809.p0.g39d2449.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202203081809.p0.g39d2449.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=39d2449 OS_GIT_VERSION=4.10.0-202203081809.p0.g39d2449.assembly.stream-39d2449 SOURCE_DATE_EPOCH=1644031330 SOURCE_GIT_COMMIT=39d2449aae17b2ae01bbd36babaec8dd5e1bfb30 SOURCE_GIT_TAG=helm-chart-aws-efs-csi-driver-1.0.0-194-g39d2449 SOURCE_GIT_URL=https://github.com/openshift/aws-efs-csi-driver 
WORKDIR /go/src/github.com/kubernetes-sigs/aws-efs-csi-driver
COPY . .
RUN make

# Use a base image with aws-efs-utils installed
FROM openshift/ose-aws-efs-utils-base:v4.10.0.20220308.182903
ENV __doozer=update BUILD_RELEASE=202203081809.p0.g39d2449.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202203081809.p0.g39d2449.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=39d2449 OS_GIT_VERSION=4.10.0-202203081809.p0.g39d2449.assembly.stream-39d2449 SOURCE_DATE_EPOCH=1644031330 SOURCE_GIT_COMMIT=39d2449aae17b2ae01bbd36babaec8dd5e1bfb30 SOURCE_GIT_TAG=helm-chart-aws-efs-csi-driver-1.0.0-194-g39d2449 SOURCE_GIT_URL=https://github.com/openshift/aws-efs-csi-driver 

# From the upstream Dockerfile:
# At image build time, static files installed by efs-utils in the config directory, i.e. CAs file, need
# to be saved in another place so that the other stateful files created at runtime, i.e. private key for
# client certificate, in the same config directory can be persisted to host with a host path volume.
# Otherwise creating a host path volume for that directory will clean up everything inside at the first time.
# Those static files need to be copied back to the config directory when the driver starts up.
RUN mv /etc/amazon/efs /etc/amazon/efs-static-files

COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-efs-csi-driver/bin/aws-efs-csi-driver /usr/bin/
ENTRYPOINT ["/usr/bin/aws-efs-csi-driver"]

LABEL \
        name="openshift/ose-aws-efs-csi-driver-container-rhel8" \
        com.redhat.component="ose-aws-efs-csi-driver-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="Storage" \
        release="202203081809.p0.g39d2449.assembly.stream" \
        io.openshift.build.commit.id="39d2449aae17b2ae01bbd36babaec8dd5e1bfb30" \
        io.openshift.build.source-location="https://github.com/openshift/aws-efs-csi-driver" \
        io.openshift.build.commit.url="https://github.com/openshift/aws-efs-csi-driver/commit/39d2449aae17b2ae01bbd36babaec8dd5e1bfb30" \
        version="v4.10.0"

