diff --git a/minio/Dockerfile b/minio/Dockerfile index f40d7b6..b9c6f75 100644 --- a/minio/Dockerfile +++ b/minio/Dockerfile @@ -1,19 +1,20 @@ -FROM homeassistant/amd64-addon-base:latest +FROM debian:stable-slim 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.62" +LABEL io.hass.version="1.0.63" -# Install curl and download MinIO binary +# Install curl and jq then 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 +RUN apt update && \ + apt install -y --no-install-recommends curl jq && \ + rm -rf /var/lib/apt/lists/* && \ + curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio \ + -o /usr/local/bin/minio && \ + chmod +x /usr/local/bin/minio # Copy the script into the container # make it executable and run it diff --git a/minio/config.json b/minio/config.json index a254cbd..2db85e1 100644 --- a/minio/config.json +++ b/minio/config.json @@ -1,6 +1,6 @@ { "name": "MinIO S3 Server", - "version": "1.0.62", + "version": "1.0.63", "slug": "minio", "description": "MinIO Server S3-compatible object storage server", "arch": [ @@ -37,6 +37,7 @@ "bucket": "str" }, "build_from": { - "amd64": "homeassistant/amd64-addon-base:latest" + "amd64": "debian:stable-slim", + "aarch64": "debian:stable-slim" } } \ No newline at end of file diff --git a/minio/run.sh b/minio/run.sh index 69c5589..6773ceb 100644 --- a/minio/run.sh +++ b/minio/run.sh @@ -1,16 +1,19 @@ #!/usr/bin/env bash set -e -bashio::log.info "Run script started" +echo "[DEBUG] Run script started" + +CONFIG="/data/options.json" # Config via HA options -ACCESS_KEY=$(bashio::config 'access_key') -SECRET_KEY=$(bashio::config 'secret_key') -REGION=$(bashio::config 'region') -BUCKET=$(bashio::config 'bucket') +ACCESS_KEY=$(jq -r .access_key "$CONFIG") +SECRET_KEY=$(jq -r .secret_key "$CONFIG") +REGION=$(jq -r .region "$CONFIG") +BUCKET=$(jq -r .bucket "$CONFIG") + # Config via env vars (for docker container) -export MINIO_ROOT_USER="${ACCESS_KEY}" -export MINIO_ROOT_PASSWORD="${SECRET_KEY}" +export MINIO_ROOT_USER="$ACCESS_KEY" +export MINIO_ROOT_PASSWORD="$SECRET_KEY" export MINIO_REGION="${REGION:-us-east-1}" @@ -19,19 +22,20 @@ 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" -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}" \ +echo "[INFO] Starting MinIO (user: $MINIO_ROOT_USER, region: $MINIO_REGION, bucket: $BUCKET)" + +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 else - bashio::log.info "Launching HTTP" - exec minio server "${DATA_DIR}" \ + echo "[INFO] Launching in HTTP mode" + exec minio server "$DATA_DIR" \ --address ":9000" \ --console-address ":9001" fi \ No newline at end of file