FROM openshift/golang-builder@sha256:21aab8ec0f5d119e4f6dab12f7ad6a1cec15d5f9071ae0c7431be760f29d4c71 AS builder
ENV __doozer=update BUILD_RELEASE=202203081819.p0.ge002694.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-202203081819.p0.ge002694.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=e002694 OS_GIT_VERSION=4.9.0-202203081819.p0.ge002694.assembly.stream-e002694 SOURCE_DATE_EPOCH=1645584534 SOURCE_GIT_COMMIT=e0026949d65c566943feabe2711ea22b256b52aa SOURCE_GIT_TAG=helm-chart-aws-efs-csi-driver-1.0.0-162-ge002694 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.9.0.20220308.190656
ENV __doozer=update BUILD_RELEASE=202203081819.p0.ge002694.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-202203081819.p0.ge002694.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=e002694 OS_GIT_VERSION=4.9.0-202203081819.p0.ge002694.assembly.stream-e002694 SOURCE_DATE_EPOCH=1645584534 SOURCE_GIT_COMMIT=e0026949d65c566943feabe2711ea22b256b52aa SOURCE_GIT_TAG=helm-chart-aws-efs-csi-driver-1.0.0-162-ge002694 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="202203081819.p0.ge002694.assembly.stream" \
        io.openshift.build.commit.id="e0026949d65c566943feabe2711ea22b256b52aa" \
        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/e0026949d65c566943feabe2711ea22b256b52aa" \
        version="v4.9.0"

