# MinIO distributes its security release as source only. Compile the official,
# pinned releases; no dependency on a removed Docker Hub / Quay image or make.
FROM golang:1.24.8-bookworm AS go-build
ENV CGO_ENABLED=0 GOTOOLCHAIN=local GOBIN=/out GOMAXPROCS=2

FROM go-build AS minio-build
RUN go install -p 2 -trimpath \
    -ldflags="-s -w -X github.com/minio/minio/cmd.Version=2025-10-15T17:29:55Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-10-15T17-29-55Z" \
    github.com/minio/minio@RELEASE.2025-10-15T17-29-55Z

FROM go-build AS mc-build
RUN go install -p 2 -trimpath \
    -ldflags="-s -w -X github.com/minio/mc/cmd.Version=2025-08-13T08:35:41Z -X github.com/minio/mc/cmd.ReleaseTag=RELEASE.2025-08-13T08-35-41Z" \
    github.com/minio/mc@RELEASE.2025-08-13T08-35-41Z

FROM python:3.12.8-slim-bookworm AS server
LABEL org.opencontainers.image.source="https://github.com/minio/minio" \
      org.opencontainers.image.version="RELEASE.2025-10-15T17-29-55Z"
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
COPY --from=minio-build /out/minio /usr/local/bin/minio
COPY infra/minio/healthcheck.py /opt/minio/healthcheck.py
RUN mkdir /data && chown 10001:10001 /data
USER 10001:10001
EXPOSE 9000
ENTRYPOINT ["minio"]
CMD ["server", "/data", "--address", ":9000", "--console-address", "127.0.0.1:9001", "--certs-dir", "/tmp/minio-certs"]

FROM python:3.12.8-slim-bookworm AS bootstrap
LABEL org.opencontainers.image.source="https://github.com/minio/mc" \
      org.opencontainers.image.version="RELEASE.2025-08-13T08-35-41Z"
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
COPY --from=mc-build /out/mc /usr/local/bin/mc
COPY infra/minio/bootstrap.py /opt/minio/bootstrap.py
USER 10001:10001
ENTRYPOINT ["python", "/opt/minio/bootstrap.py"]
