FROM golang:1.26.4

# See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
# for the latest gh install instructions when the below didn't work

RUN type -p curl >/dev/null || (apt update && apt install curl -y)

RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
  && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
  && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
  && apt update \
  && apt install gh -y

ARG HELM_DIFF_UID

RUN adduser \
  --gecos "Helm Diff" \
  --disabled-password \
  -u "$HELM_DIFF_UID" \
  helm-diff-releaser \
  --shell /bin/sh

USER helm-diff-releaser