FROM debian:bookworm

ARG VERSION=2.2.0

RUN apt-get update
RUN apt-get install -y \
  curl \
  ca-certificates \
  gnupg

RUN curl -fsSL https://releases.hyperion-project.org/hyperion.pub.key | gpg --dearmor \
  -o /usr/share/keyrings/hyperion.pub.gpg
	
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/hyperion.pub.gpg] https://apt.releases.hyperion-project.org/ bookworm main" \
  > /etc/apt/sources.list.d/hyperion.list

RUN curl -L -o /tmp/hyperion.deb \
  https://github.com/hyperion-project/hyperion.ng/releases/download/${VERSION}/Hyperion-${VERSION}-Linux-amd64.deb

RUN apt-get update
RUN apt-get install -y /tmp/hyperion.deb
RUN rm /tmp/hyperion.deb
RUN rm -rf /var/lib/apt/lists/*

ENV UID=1000
ENV GID=1000

RUN groupadd -f hyperion
RUN useradd -r -s /bin/bash -g hyperion hyperion

ENTRYPOINT ["/usr/bin/hyperiond", "-u", "/data"]
