chore: switch to Alpine base with jq for MinIO addon
This commit is contained in:
@@ -11,6 +11,7 @@ If you want to do add the repository manually, please follow the procedure highl
|
|||||||
### [MinIO](./minio)
|
### [MinIO](./minio)
|
||||||
|
|
||||||
![Supports amd64 Architecture][amd64-shield]
|
![Supports amd64 Architecture][amd64-shield]
|
||||||
|
![Supports aarch64 Architecture][aarch64-shield]
|
||||||
|
|
||||||
_MinIO is a High Performance Object Storage released under GNU Affero General Public License v3.0. It is API compatible with Amazon S3 cloud storage service._
|
_MinIO is a High Performance Object Storage released under GNU Affero General Public License v3.0. It is API compatible with Amazon S3 cloud storage service._
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
FROM debian:stable-slim
|
FROM alpine:3.18
|
||||||
|
|
||||||
LABEL io.hass.name="MinIO"
|
LABEL io.hass.name="MinIO"
|
||||||
LABEL io.hass.description="S3-compatible object storage for HA"
|
LABEL io.hass.description="S3-compatible object storage for HA"
|
||||||
LABEL io.hass.arch="amd64|aarch64"
|
LABEL io.hass.arch="amd64|aarch64"
|
||||||
LABEL io.hass.type="addon"
|
LABEL io.hass.type="addon"
|
||||||
LABEL io.hass.version="1.0.63"
|
LABEL io.hass.version="1.0.64"
|
||||||
|
|
||||||
# Install curl and jq then download MinIO binary
|
# Install curl, jq and ca-certificates
|
||||||
|
RUN apk add --no-cache bash curl jq ca-certificates
|
||||||
|
|
||||||
|
# Install the latest version of MinIO
|
||||||
# https://min.io/download#/linux
|
# https://min.io/download#/linux
|
||||||
# https://docs.min.io/docs/minio-server-quickstart-guide.html
|
# https://docs.min.io/docs/minio-server-quickstart-guide.html
|
||||||
RUN apt update && \
|
RUN curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio \
|
||||||
apt install -y --no-install-recommends curl jq && \
|
-o /usr/local/bin/minio && \
|
||||||
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
|
chmod +x /usr/local/bin/minio
|
||||||
|
|
||||||
# Copy the script into the container
|
# Copy the script into the container
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Home Assistant Add-on: MinIO
|
# Home Assistant Add-on: MinIO
|
||||||
|
|
||||||
![Supports amd64 Architecture][amd64-shield]
|
![Supports amd64 Architecture][amd64-shield]
|
||||||
|
![Supports aarch64 Architecture][aarch64-shield]
|
||||||
|
|
||||||
This add-on provides an **S3-compatible** server based on MinIO, perfect for:
|
This add-on provides an **S3-compatible** server based on MinIO, perfect for:
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "MinIO S3 Server",
|
"name": "MinIO S3 Server",
|
||||||
"version": "1.0.63",
|
"version": "1.0.64",
|
||||||
"slug": "minio",
|
"slug": "minio",
|
||||||
"description": "MinIO Server S3-compatible object storage server",
|
"description": "MinIO Server S3-compatible object storage server",
|
||||||
"arch": [
|
"arch": [
|
||||||
"amd64"
|
"amd64",
|
||||||
|
"aarch64"
|
||||||
],
|
],
|
||||||
"startup": "services",
|
"startup": "services",
|
||||||
"boot": "auto",
|
"boot": "auto",
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
"bucket": "str"
|
"bucket": "str"
|
||||||
},
|
},
|
||||||
"build_from": {
|
"build_from": {
|
||||||
"amd64": "debian:stable-slim",
|
"amd64": "alpine:3.18",
|
||||||
"aarch64": "debian:stable-slim"
|
"aarch64": "alpine:3.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
27
minio/run.sh
27
minio/run.sh
@@ -4,37 +4,42 @@ echo "[DEBUG] Run script started"
|
|||||||
|
|
||||||
CONFIG="/data/options.json"
|
CONFIG="/data/options.json"
|
||||||
|
|
||||||
# Config via HA options
|
# Extract config values from the JSON file
|
||||||
|
# The file is created by the Home Assistant Add-on system
|
||||||
|
# and contains the configuration options defined in the add-on config.json file
|
||||||
|
# The jq command is used to parse the JSON file and extract the values
|
||||||
ACCESS_KEY=$(jq -r .access_key "$CONFIG")
|
ACCESS_KEY=$(jq -r .access_key "$CONFIG")
|
||||||
SECRET_KEY=$(jq -r .secret_key "$CONFIG")
|
SECRET_KEY=$(jq -r .secret_key "$CONFIG")
|
||||||
REGION=$(jq -r .region "$CONFIG")
|
REGION=$(jq -r .region "$CONFIG")
|
||||||
BUCKET=$(jq -r .bucket "$CONFIG")
|
BUCKET=$(jq -r .bucket "$CONFIG")
|
||||||
|
|
||||||
|
|
||||||
# Config via env vars (for docker container)
|
# Configure MinIO environment variables
|
||||||
|
# These variables are used to set up the MinIO server
|
||||||
|
# The ACCESS_KEY and SECRET_KEY are used for authentication
|
||||||
|
# The REGION is used to set the region for the MinIO server
|
||||||
|
# The BUCKET is the name of the bucket to be created
|
||||||
export MINIO_ROOT_USER="$ACCESS_KEY"
|
export MINIO_ROOT_USER="$ACCESS_KEY"
|
||||||
export MINIO_ROOT_PASSWORD="$SECRET_KEY"
|
export MINIO_ROOT_PASSWORD="$SECRET_KEY"
|
||||||
export MINIO_REGION="${REGION:-us-east-1}"
|
export MINIO_REGION="${REGION:-us-east-1}"
|
||||||
|
|
||||||
|
# Check if the bucket exists, if not create it
|
||||||
# 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"
|
DATA_DIR="/data/$BUCKET"
|
||||||
mkdir -p "$DATA_DIR"
|
mkdir -p "$DATA_DIR"
|
||||||
|
|
||||||
echo "[INFO] Starting MinIO (user: $MINIO_ROOT_USER, region: $MINIO_REGION, bucket: $BUCKET)"
|
echo "[INFO] Starting MinIO (user: $MINIO_ROOT_USER, region: $MINIO_REGION, bucket: $BUCKET)"
|
||||||
|
|
||||||
if [[ -f "$CERT_PATH" && -f "$KEY_PATH" ]]; then
|
# Autodetect if TLS certs are present
|
||||||
echo "[INFO] TLS cert found, launching in HTTPS mode"
|
# If they are, launch with HTTPS, otherwise use HTTP
|
||||||
|
# This is a workaround for the fact that the minio server command does not have a --tls flag
|
||||||
|
if [[ -f /ssl/cert.pem && -f /ssl/key.pem ]]; then
|
||||||
|
echo "[INFO] TLS cert found, launching HTTPS"
|
||||||
exec minio server "$DATA_DIR" \
|
exec minio server "$DATA_DIR" \
|
||||||
--address ":9000" \
|
--address ":9000" \
|
||||||
--console-address ":9001" \
|
--console-address ":9001" \
|
||||||
--certs-dir /ssl
|
--certs-dir /ssl
|
||||||
else
|
else
|
||||||
echo "[INFO] Launching in HTTP mode"
|
echo "[INFO] Launching HTTP"
|
||||||
exec minio server "$DATA_DIR" \
|
exec minio server "$DATA_DIR" \
|
||||||
--address ":9000" \
|
--address ":9000" \
|
||||||
--console-address ":9001"
|
--console-address ":9001"
|
||||||
|
|||||||
Reference in New Issue
Block a user