Files

43 lines
2.2 KiB
Docker

# MinIO server built from its AGPLv3 source at an upstream release tag. Upstream stopped publishing
# pullable images (docker.io 404, quay.io auth-only), so we build and host them ourselves.
# Drop-in for quay.io/minio/minio: same entrypoint behaviour, and bundles mc, curl and sh like upstream.
ARG GO_VERSION=1.24
FROM --platform=$BUILDPLATFORM docker.io/library/golang:${GO_VERSION} AS build
ARG TARGETOS TARGETARCH
ARG MINIO_REF
ARG MC_REF
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GOFLAGS=-trimpath MINIO_RELEASE=RELEASE MC_RELEASE=RELEASE
WORKDIR /src
RUN git clone -q --depth 1 --branch "$MINIO_REF" https://github.com/minio/minio.git minio \
&& git clone -q --depth 1 --branch "$MC_REF" https://github.com/minio/mc.git mc
RUN cd minio && GOOS= GOARCH= go run buildscripts/gen-ldflags.go "$(echo "${MINIO_REF#RELEASE.}" | sed -E 's/T([0-9]{2})-([0-9]{2})-([0-9]{2})Z/T\1:\2:\3Z/')" > /tmp/ld \
&& go build -tags kqueue -ldflags "$(cat /tmp/ld)" -o /out/minio .
RUN cd mc && GOOS= GOARCH= go run buildscripts/gen-ldflags.go "$(echo "${MC_REF#RELEASE.}" | sed -E 's/T([0-9]{2})-([0-9]{2})-([0-9]{2})Z/T\1:\2:\3Z/')" > /tmp/ld \
&& go build -ldflags "$(cat /tmp/ld)" -o /out/mc .
FROM docker.io/library/alpine:3.20 AS minio
ARG MINIO_REF
LABEL org.opencontainers.image.source="https://github.com/minio/minio" \
org.opencontainers.image.version="$MINIO_REF" \
org.opencontainers.image.licenses="AGPL-3.0-or-later"
RUN apk add --no-cache ca-certificates curl
COPY --from=build /out/minio /out/mc /usr/bin/
COPY docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
ENV MINIO_ACCESS_KEY_FILE=access_key MINIO_SECRET_KEY_FILE=secret_key \
MINIO_ROOT_USER_FILE=access_key MINIO_ROOT_PASSWORD_FILE=secret_key \
MINIO_KMS_SECRET_KEY_FILE=kms_master_key MINIO_UPDATE_MINISIGN_PUBKEY="" \
MINIO_CONFIG_ENV_FILE=config.env MC_CONFIG_DIR=/tmp/.mc
EXPOSE 9000
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
CMD ["minio"]
FROM docker.io/library/alpine:3.20 AS mc
ARG MC_REF
LABEL org.opencontainers.image.source="https://github.com/minio/mc" \
org.opencontainers.image.version="$MC_REF" \
org.opencontainers.image.licenses="AGPL-3.0-or-later"
RUN apk add --no-cache ca-certificates
COPY --from=build /out/mc /usr/bin/mc
ENTRYPOINT ["mc"]