FROM golang:1.24.3-alpine AS build RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git RUN git clone --depth 1 --branch RELEASE.2025-04-16T18-13-26Z https://github.com/minio/mc.git /src WORKDIR /src RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /mc . && exit 0; done; exit 1 FROM alpine:3.22.1 RUN apk add --no-cache ca-certificates curl COPY --from=build /mc /usr/local/bin/mc ENTRYPOINT ["mc"]