From 60666b94cca46a0eb40ed5ec5e6b3b03861c876a Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 6 May 2025 01:00:23 +0200 Subject: [PATCH] change base-image --- minio/Dockerfile | 24 +++++++++++++++++------- minio/config.json | 2 +- minio/run.sh | 38 +++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/minio/Dockerfile b/minio/Dockerfile index 80b8cd2..9a49bd4 100644 --- a/minio/Dockerfile +++ b/minio/Dockerfile @@ -1,12 +1,22 @@ -FROM minio/minio:latest +FROM ghcr.io/home-assistant/amd64-addon-base:latest -LABEL \ - io.hass.version="1.0.5" \ - io.hass.type="addon" \ - io.hass.arch="aarch64|amd64" \ - io.hass.name="MinIO" \ - io.hass.description="MinIO is an object storage server compatible with Amazon S3." +LABEL io.hass.name="MinIO" +LABEL io.hass.description="S3-compatible object storage for HA" +LABEL io.hass.arch="amd64|aarch64" +LABEL io.hass.type="addon" +LABEL io.hass.version="1.0.6" +# Install curl and download MinIO binary +# https://min.io/download#/linux +# https://docs.min.io/docs/minio-server-quickstart-guide.html +RUN apk add --no-cache curl \ + && curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio \ + -o /usr/local/bin/minio \ + && chmod +x /usr/local/bin/minio \ + && apk del curl + +# Copy the script into the container +# make it executable and run it COPY run.sh /run.sh RUN chmod +x /run.sh diff --git a/minio/config.json b/minio/config.json index 2c7f8ae..9984586 100644 --- a/minio/config.json +++ b/minio/config.json @@ -1,6 +1,6 @@ { "name": "MinIO S3 Server", - "version": "1.0.5", + "version": "1.0.6", "slug": "minio", "description": "MinIO Server S3-compatible object storage server", "arch": [ diff --git a/minio/run.sh b/minio/run.sh index 6fcc46e..69c5589 100644 --- a/minio/run.sh +++ b/minio/run.sh @@ -1,25 +1,37 @@ #!/usr/bin/env bash set -e -echo "[DEBUG] Run script started" +bashio::log.info "Run script started" # Config via HA options -export MINIO_ROOT_USER="${access_key}" -export MINIO_ROOT_PASSWORD="${secret_key}" -export MINIO_REGION="${region:-us-east-1}" +ACCESS_KEY=$(bashio::config 'access_key') +SECRET_KEY=$(bashio::config 'secret_key') +REGION=$(bashio::config 'region') +BUCKET=$(bashio::config 'bucket') + +# Config via env vars (for docker container) +export MINIO_ROOT_USER="${ACCESS_KEY}" +export MINIO_ROOT_PASSWORD="${SECRET_KEY}" +export MINIO_REGION="${REGION:-us-east-1}" + # TLS support (optional, autodetect) CERT_PATH="/ssl/cert.pem" KEY_PATH="/ssl/key.pem" # First-run: make sure bucket exists (done via client) -DATA_DIR="/data/${bucket}" -mkdir -p "$DATA_DIR" +DATA_DIR="/data/${BUCKET}" +mkdir -p "${DATA_DIR}" -echo "[INFO] Starting MinIO (user: $MINIO_ROOT_USER, region: $MINIO_REGION)" -if [[ -f "$CERT_PATH" && -f "$KEY_PATH" ]]; then - echo "[INFO] TLS cert found, launching in HTTPS mode" - exec minio server "$DATA_DIR" --address ":9000" --console-address ":9001" --certs-dir /ssl +bashio::log.info "Starting MinIO (user: ${ACCESS_KEY}, region: ${MINIO_REGION}, bucket: ${BUCKET})" +if bashio::fs.file_exists '/ssl/cert.pem' && bashio::fs.file_exists '/ssl/key.pem'; then + bashio::log.info "TLS cert found, launching HTTPS" + exec minio server "${DATA_DIR}" \ + --address ":9000" \ + --console-address ":9001" \ + --certs-dir /ssl else - echo "[INFO] Launching in HTTP mode" - exec minio server "$DATA_DIR" --address ":9000" --console-address ":9001" -fi + bashio::log.info "Launching HTTP" + exec minio server "${DATA_DIR}" \ + --address ":9000" \ + --console-address ":9001" +fi \ No newline at end of file