From 603f45a97fe8b98cf7031cd25f25ebc3a263a822 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:39:17 +0800 Subject: [PATCH] Dockerfile: align `gh` installation with upstream documentation The commands to install `gh` were changed in cli/cli#8693. We should align what we do there to make what's happening here a bit more transparent. --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a8bc9ea58..fde7c051f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu # Ubuntu thinks is best. # hadolint ignore=DL3008 +# `gh` installation taken from https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt # /etc/lsb-release is checked inside the container and sets DISTRIB_RELEASE. # We need `[` instead of `[[` because the shell is `/bin/sh`. # shellcheck disable=SC1091,SC2154,SC2292 @@ -44,9 +45,10 @@ RUN apt-get update \ tzdata \ jq \ && if [ "$(. /etc/lsb-release; echo "${DISTRIB_RELEASE}" | cut -d. -f1)" -ge 22 ]; then apt-get install -y --no-install-recommends skopeo; fi \ - && 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 \ + && mkdir -p -m 755 /etc/apt/keyrings \ + && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list >/dev/null \ && apt-get update \ && apt-get install -y --no-install-recommends gh \ && apt-get remove --purge -y software-properties-common \