From 411f94d873da8881decbcdbb9f189500805b1c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Varl=C4=B1?= Date: Fri, 31 Jan 2025 15:18:24 +0000 Subject: [PATCH] Update `Dockerfile`s to use CSI minimal distro as base image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With containerization, we will run Mountpoint inside our container and we will need `libfuse` and `glibc` for Mountpoint to run - which CSI base image provides. Signed-off-by: Burak Varlı --- Dockerfile | 11 +++++++---- Dockerfile.local | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9375bbb..9afb17c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,19 +49,22 @@ ARG TARGETARCH WORKDIR /go/src/github.com/awslabs/mountpoint-s3-csi-driver COPY . . RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod \ -TARGETARCH=${TARGETARCH} make bin + TARGETARCH=${TARGETARCH} make bin -FROM --platform=$TARGETPLATFORM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base:latest AS linux-amazon +# `eks-distro-minimal-base-csi` includes `libfuse` and mount utils such as `umount`. +# We need to make sure to use same Amazon Linux version here and while producing Mountpoint to not have glibc compatibility issues. +FROM --platform=$TARGETPLATFORM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi:latest AS linux-amazon ARG MOUNTPOINT_VERSION ENV MOUNTPOINT_VERSION=${MOUNTPOINT_VERSION} ENV MOUNTPOINT_BIN_DIR=/mountpoint-s3/bin -# MP Installer +# Copy Mountpoint binary COPY --from=mp_builder /mountpoint-s3 /mountpoint-s3 +# TODO: These won't be necessary once with containerization. COPY --from=mp_builder /lib64/libfuse.so.2 /mountpoint-s3/bin/ COPY --from=mp_builder /lib64/libgcc_s.so.1 /mountpoint-s3/bin/ -# Install driver +# Copy CSI Driver binaries COPY --from=builder /go/src/github.com/awslabs/mountpoint-s3-csi-driver/bin/aws-s3-csi-driver /bin/aws-s3-csi-driver COPY --from=builder /go/src/github.com/awslabs/mountpoint-s3-csi-driver/bin/install-mp /bin/install-mp diff --git a/Dockerfile.local b/Dockerfile.local index afbef434..089be3b3 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -28,7 +28,7 @@ RUN dnf upgrade -y && \ pkg-config && \ dnf clean all -# Install rust +# Install Rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" @@ -45,7 +45,7 @@ RUN cd mountpoint-s3 && \ # Build CSI Driver # -# Build driver. Use BUILDPLATFORM not TARGETPLATFORM for cross compilation +# Use BUILDPLATFORM not TARGETPLATFORM for cross compilation FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/golang:1.22-bullseye as builder ARG TARGETARCH @@ -54,17 +54,24 @@ COPY . . RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod \ TARGETARCH=${TARGETARCH} make bin -FROM --platform=$TARGETPLATFORM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base:latest AS linux-amazon +# +# Build the final image +# + +# `eks-distro-minimal-base-csi` includes `libfuse` and mount utils such as `umount`. +# We need to make sure to use same Amazon Linux version here and while building Mountpoint to not have glibc compatibility issues. +FROM --platform=$TARGETPLATFORM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi:latest-al23 AS linux-amazon ARG MOUNTPOINT_VERSION ENV MOUNTPOINT_VERSION=${MOUNTPOINT_VERSION} ENV MOUNTPOINT_BIN_DIR=/mountpoint-s3/bin -# MP Installer +# Copy Mountpoint binary COPY --from=mp_builder /mountpoint-s3/target/release/mount-s3 /mountpoint-s3/bin/mount-s3 +# TODO: These won't be necessary once with containerization. COPY --from=mp_builder /lib64/libfuse.so.2 /mountpoint-s3/bin/ COPY --from=mp_builder /lib64/libgcc_s.so.1 /mountpoint-s3/bin/ -# Install driver +# Copy CSI Driver binaries COPY --from=builder /go/src/github.com/awslabs/mountpoint-s3-csi-driver/bin/aws-s3-csi-driver /bin/aws-s3-csi-driver COPY --from=builder /go/src/github.com/awslabs/mountpoint-s3-csi-driver/bin/install-mp /bin/install-mp