diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1d6ce0e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +target +.git +.github +.idea +*.iml +book diff --git a/README.md b/README.md index 1e190a3..4a3afac 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,39 @@ Important: - the native path currently targets custom image panels; built-in vendor sensor themes are not yet reimplemented in the web UI +## Native Container Variant + +This fork also ships a separate containerized Unraid-friendly variant based purely on `aoostar-rs`. + +Files: + +- `container/Dockerfile` +- `container/entrypoint.sh` +- `container/unraid/aoostar-rs-webui.xml` + +Build locally from the repository root: + +```bash +docker build -f container/Dockerfile -t aoostar-rs-webui:latest . +``` + +Example run: + +```bash +docker run -d \ + --name aoostar-rs-webui \ + --device /dev/ttyACM0:/dev/ttyACM0 \ + -p 8080:8080 \ + -v /mnt/user/appdata/aoostar-rs/config:/config \ + aoostar-rs-webui:latest +``` + +The container starts only the native Rust stack: + +- `aster-webui` on port `8080` +- direct LCD rotation through `aoostar-rs` +- no vendor binary and no `_MEI*/sys_img` runtime sync + ## Disclaimer > I take no responsibility for the use of this software. diff --git a/container/Dockerfile b/container/Dockerfile new file mode 100644 index 0000000..8dc3e96 --- /dev/null +++ b/container/Dockerfile @@ -0,0 +1,42 @@ +FROM rust:1.88-bookworm AS builder + +WORKDIR /build + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + pkg-config \ + libudev-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY . /build + +RUN cargo build --release -p aster-webui + +FROM debian:bookworm-slim + +ENV CONFIG_DIR=/config \ + PORT=8080 \ + ASTER_DEVICE=/dev/ttyACM0 \ + ASTER_USB= \ + ASTER_SIMULATE=0 \ + ASTER_WRITE_ONLY=0 \ + ASTER_DISABLE_DISPLAY=0 + +WORKDIR /app + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + bash \ + libudev1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /build/target/release/aster-webui /usr/local/bin/aster-webui +COPY container/entrypoint.sh /usr/local/bin/entrypoint.sh + +RUN chmod 0755 /usr/local/bin/aster-webui /usr/local/bin/entrypoint.sh + +EXPOSE 8080 +VOLUME ["/config"] + +CMD ["/usr/local/bin/entrypoint.sh"] diff --git a/container/entrypoint.sh b/container/entrypoint.sh new file mode 100644 index 0000000..7fac284 --- /dev/null +++ b/container/entrypoint.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +set -euo pipefail + +CONFIG_DIR="${CONFIG_DIR:-/config}" +PORT="${PORT:-8080}" +ASTER_DEVICE="${ASTER_DEVICE:-}" +ASTER_USB="${ASTER_USB:-}" +ASTER_SIMULATE="${ASTER_SIMULATE:-0}" +ASTER_WRITE_ONLY="${ASTER_WRITE_ONLY:-0}" +ASTER_DISABLE_DISPLAY="${ASTER_DISABLE_DISPLAY:-0}" + +mkdir -p "${CONFIG_DIR}" "${CONFIG_DIR}/img" + +ARGS=( + "--config-dir" "${CONFIG_DIR}" + "--bind" "0.0.0.0:${PORT}" +) + +if [[ -n "${ASTER_DEVICE}" ]]; then + ARGS+=("--device" "${ASTER_DEVICE}") +fi + +if [[ -n "${ASTER_USB}" ]]; then + ARGS+=("--usb" "${ASTER_USB}") +fi + +if [[ "${ASTER_SIMULATE}" == "1" ]]; then + ARGS+=("--simulate") +fi + +if [[ "${ASTER_WRITE_ONLY}" == "1" ]]; then + ARGS+=("--write-only") +fi + +if [[ "${ASTER_DISABLE_DISPLAY}" == "1" ]]; then + ARGS+=("--disable-display") +fi + +echo "Starting aster-webui native container" +echo "Config directory: ${CONFIG_DIR}" +echo "WebUI port: ${PORT}" +echo "Display mode: $( + if [[ "${ASTER_DISABLE_DISPLAY}" == "1" ]]; then + printf '%s' 'disabled' + elif [[ "${ASTER_SIMULATE}" == "1" ]]; then + printf '%s' 'simulate' + elif [[ -n "${ASTER_DEVICE}" ]]; then + printf 'device:%s' "${ASTER_DEVICE}" + elif [[ -n "${ASTER_USB}" ]]; then + printf 'usb:%s' "${ASTER_USB}" + else + printf '%s' 'default-usb' + fi +)" + +APP_PID="" + +shutdown() { + if [[ -n "${APP_PID}" ]] && kill -0 "${APP_PID}" >/dev/null 2>&1; then + kill -TERM "${APP_PID}" >/dev/null 2>&1 || true + wait "${APP_PID}" || true + fi +} + +trap shutdown INT TERM + +/usr/local/bin/aster-webui "${ARGS[@]}" & +APP_PID="$!" +wait "${APP_PID}" diff --git a/container/unraid/aoostar-rs-webui.xml b/container/unraid/aoostar-rs-webui.xml new file mode 100644 index 0000000..117c65e --- /dev/null +++ b/container/unraid/aoostar-rs-webui.xml @@ -0,0 +1,31 @@ + + + AOOSTAR-RS-WebUI + aoostar-rs-webui:latest + + bridge + + sh + false + http://10.1.1.4:3000/magges/aoostar-rs + http://10.1.1.4:3000/magges/aoostar-rs + Native AOOSTAR WTR MAX / GEM12+ PRO container based on aoostar-rs. Fuehrt die neue Rust-WebUI und die Display-Rotation direkt ohne Hersteller-Binary aus. + Tools: + http://[IP]:[PORT:8080]/ + http://10.1.1.4:3000/magges/unraid-aoostar-x/raw/branch/main/unraid/icon.png + + + + 1749470000 + + + Durchgereichtes Display-Geraet, typischerweise /dev/ttyACM0. Nutzt nur aoostar-rs, keine Hersteller-Binary. + 8080 + /mnt/user/appdata/aoostar-rs/config + /dev/ttyACM0 + /dev/ttyACM0 + + 0 + 0 + 0 +