From 83705a35cd55c3f9919d1b94c6cf02222b5b0e85 Mon Sep 17 00:00:00 2001 From: David Claeys Date: Mon, 26 Jan 2026 18:11:51 +0100 Subject: [PATCH] initial commit --- .gitea/workflows/action.yml | 54 +++++++++++++ Dockerfile | 51 +++++++++++++ LICENSE | 2 +- README.md | 147 ++++++++++++++++++++++++++++++++++++ docker-compose.yml | 17 +++++ 5 files changed, 270 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/action.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml new file mode 100644 index 0000000..eab1149 --- /dev/null +++ b/.gitea/workflows/action.yml @@ -0,0 +1,54 @@ +name: 'Build docker container' +on: + push: + tags: + - '*' + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ GITHUB_WORKSPACE }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Docker + run: | + echo "Checking docker installation" + if command -v docker &> /dev/null; then + echo "Docker installation found" + else + echo "Docker installation not found. Docker will be installed" + curl -fsSL https://get.docker.com | sh + fi + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + - name: Login to Gitea container registry + uses: https://github.com/docker/login-action@v3 + with: + registry: git.claeyscloud.com + username: nologin + password: ${{ secrets.PACKAGE_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + labels: | + org.opencontainers.image.title=hyperion-docker + org.opencontainers.image.description=Docker image of Hyperion + org.opencontainers.image.authors=Davidquinonescl + org.opencontainers.image.documentation=https://git.claeyscloud.com/david/hyperion-docker + images: | + davidquinonescl/hyperion-docker + tags: | + type=semver,pattern={{raw}} + type=sha + - name: Build and push + uses: https://github.com/docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..da06c83 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM debian:bullseye + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y wget gpg sudo libpython3.9 && \ + wget -qO /tmp/hyperion.pub.key https://apt.hyperion-project.org/hyperion.pub.key && \ + gpg --dearmor -o /usr/share/keyrings/hyperion.pub.gpg /tmp/hyperion.pub.key && \ + echo "deb [signed-by=/usr/share/keyrings/hyperion.pub.gpg] https://apt.hyperion-project.org/ bullseye main" > /etc/apt/sources.list.d/hyperion.list && \ + echo "deb [signed-by=/usr/share/keyrings/hyperion.nightly.pub.gpg] https://nightly.apt.hyperion-project.org/ bullseye main" > /etc/apt/sources.list.d/hyperion.nightly.list.disabled && \ + apt-get update && \ + apt-get install -y hyperion && \ + apt-get -y --purge autoremove gpg && \ + apt-get clean + + +# Flatbuffers Server port +EXPOSE 19400 + +# JSON-RPC Server Port +EXPOSE 19444 + +# Protocol Buffers Server port +EXPOSE 19445 + +# Boblight Server port +EXPOSE 19333 + +# Philips Hue Entertainment mode (UDP) +EXPOSE 2100 + +# HTTP and HTTPS Web UI default ports +EXPOSE 8090 +EXPOSE 8092 + +ENV UID=1000 +ENV GID=1000 + +RUN groupadd -f hyperion +RUN useradd -r -s /bin/bash -g hyperion hyperion + +RUN echo "#!/bin/bash" > /start.sh +RUN echo "groupmod -g \$2 hyperion" >> /start.sh +RUN echo "usermod -u \$1 hyperion" >> /start.sh +RUN echo "chown -R hyperion:hyperion /config" >> /start.sh +RUN echo "sudo -u hyperion /usr/bin/hyperiond -v --service -u /config" >> /start.sh + +RUN chmod 777 /start.sh + +VOLUME /config + +CMD [ "bash", "-c", "/start.sh ${UID} ${GID}" ] diff --git a/LICENSE b/LICENSE index a4fe735..63a09c6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 david +Copyright (c) 2026 David Claeys Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including diff --git a/README.md b/README.md index 97aea15..f942ea2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,149 @@ # hyperion-docker +Repository based on https://github.com/psychowood/hyperion.ng-docker + +![Hyperion](https://github.com/hyperion-project/hyperion.ng/blob/master/doc/logo_dark.png?raw=true#gh-dark-mode-only) +![Hyperion](https://github.com/hyperion-project/hyperion.ng/blob/master/doc/logo_light.png?raw=true#gh-light-mode-only) + +This is a simple repository containining some `docker-compose.yml` sample files useful for running [hyperiong.ng](https://github.com/hyperion-project/hyperion.ng/#readme) as a service inside a docker environment, without having to rely on one of the closed sources docker images running wild out there. +Just copy-paste and `docker-compose up -d` it. + +The docker-compose file is quite simple: + +1. It's based on the [official Debian 11 (bullseye) docker image](https://hub.docker.com/_/debian) +2. It downloads the hyperion official package from the [official hyperion apt package repository](https://apt.hyperion-project.org/) +3. Maps the `/config` dirctory as an external volume, to keep your settings +4. Runs hyperiond service as non-root user. Default UID:GID are 1000:1000 but they can be easily changed adding a `.env` file + +The setup is done on first run. + +Sadly, the resulting image is not exaclty slim at ~500MB, because hyperion has lots of dependencies. Since many of them are for the Desktop/Qt UI, it should be possible to slim the image up by cherry picking the ones not used but the cli service, but that's probably not really worth it. + +On the other hand, the running service does not need lots of RAM (on my system takes ~64MB without the cache). + +You have different options to run this image, after starting the container you can reach the web ui going either to http://youdockerhost:8090 or https://youdockerhost:8092 + +### Standard configuration + +Simply said: git clone the repo (or directly download the Dockerfile) + +```sh +git clone https://github.com/psychowood/hyperion.ng-docker +``` +docker build the local image +```sh +docker build -t hyperionng --no-cache . +``` +if you want to run a nightly hyperionng build, run this additional build command to update the local image +```sh +docker build -t hyperionng -f Dockerfile.nightly . +``` +start the container with `docker compose up -d` with the following `docker-compose.yml` file (included in the repo): +```yaml +version: '3.3' + +services: + hyperionng: + image: hyperionng:latest + container_name: hyperionng + volumes: + - hyperionng-config:/config + ports: + - "19400:19400" + - "19444:19444" + - "19445:19445" + - "8090:8090" + - "8092:8092" + restart: unless-stopped +volumes: + hyperionng-config: +``` + +### Standalone configuration + +This configuration (found in `docker-compose.standalone.yml`) is completely built when upping the container, it runs of debian:bullseye image and installs hyperion and dependencies at first boot. +All the main hyperion ports are mapped on your docker host. + +```yaml +version: '3.3' + +services: + hyperionng: + image: debian:bullseye + container_name: hyperionng + command: bash -c "groupadd -f hyperion || true && + adduser -q --uid ${UID:-1000} --gid ${GID:-1000} --disabled-password --no-create-home hyperion || true && + mkdir -p /config && + chown ${UID:-1000}:${GID:-1000} /config && + apt-get update && + apt-get install -y wget gpg sudo libpython3.9 && + wget -qO /tmp/hyperion.pub.key https://apt.hyperion-project.org/hyperion.pub.key && + gpg --dearmor -o - /tmp/hyperion.pub.key > /usr/share/keyrings/hyperion.pub.gpg && + echo \"deb [signed-by=/usr/share/keyrings/hyperion.pub.gpg] https://apt.hyperion-project.org/ bullseye main\" > /etc/apt/sources.list.d/hyperion.list && + apt-get update && + apt-get install -y hyperion && + apt-get clean && + sudo -u hyperion /usr/bin/hyperiond -v --service -u /config" + ports: + - "19400:19400" + - "19444:19444" + - "19445:19445" + - "8090:8090" + - "8092:8092" + volumes: + - hyperionng-config:/config + restart: unless-stopped +volumes: + hyperionng-config: + +``` + +In both cases, you may want to adapt the "ports" section adding other port mappings for specific cases (e.g. "2100:2100/udp" for Philips Hue in Entertainment mode). + +An alternative, especially if you need advanced functions like mDNS and SSDP services, could be running the cointainer in a macvlan network bridged to your local one. The following is an example that exposes the hyperionng container with the 192.168.1.17 IP in a local network 192.168.1.0/24 with the gateway 192.168.1.1, please adapt the configuration to your specific case. + +```yaml +version: '3.3' + +services: + hyperionng: + image: hyperionng:latest + container_name: hyperionng + volumes: + - hyperionng-config:/config + networks: + mylannet: + ipv4_address: 192.168.1.17 + restart: unless-stopped +volumes: + hyperionng-config: +# define networks +networks: + mylannet: + name: mylannet + driver: macvlan + driver_opts: + parent: eth0 + ipam: + config: + - subnet: 192.168.1.0/24 + gateway: 192.168.1.1 + ip_range: 192.168.1.64/26 +``` + +Moreover, if you want to use some hardware devices (USB. serial, video, and so on), you need to passthrough the correct one adding a devices section in the compose file (the following is jut an example): + +```yaml +devices: + - /dev/ttyACM0:/dev/ttyACM0 + - /dev/video1:/dev/video1 + - /dev/ttyUSB1:/dev/ttyUSB0 + - /dev/spidev0.0:/dev/spidev0.0 +``` + +If you want to use different UID and GID, you can add a `.env` file in the same folder of your `docker-compose.yml` file: + +```properties +UID=1100 +GID=1100 +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ebf4a83 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.3' + +services: + hyperionng: + image: hyperionng:latest + container_name: hyperionng + volumes: + - hyperionng-config:/config + ports: + - "19400:19400" + - "19444:19444" + - "19445:19445" + - "8090:8090" + - "8092:8092" + restart: unless-stopped +volumes: + hyperionng-config: