mirror of
https://github.com/hanzoai/docker-github-actions-runner.git
synced 2026-09-30 21:42:55 +00:00
The apt repo for the gh cli is broken due to an expired GPG key: https://github.com/cli/cli/issues/6175 They want to retire the debian packaging altogether https://github.com/cli/cli/issues/5941 and this is the recommended "long term" solution https://github.com/cli/cli/issues/6175#issuecomment-1235984381. Adapted from https://github.com/cli/cli/issues/6175#issuecomment-1236264607 Fixes #236
81 lines
5.2 KiB
Docker
81 lines
5.2 KiB
Docker
FROM ubuntu:focal
|
|
LABEL maintainer="[email protected]"
|
|
|
|
ARG DUMB_INIT_VERSION="1.2.2"
|
|
ARG GIT_CORE_PPA_KEY="A1715D88E1DF1F24"
|
|
|
|
ENV DOCKER_COMPOSE_VERSION="1.27.4"
|
|
ENV GIT_LFS_VERSION="3.2.0"
|
|
ENV LANG=en_US.UTF-8
|
|
ENV LANGUAGE=en_US.UTF-8
|
|
ENV LC_ALL=en_US.UTF-8
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
# hadolint ignore=DL3003,DL4001,SC2086
|
|
RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends gnupg \
|
|
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${GIT_CORE_PPA_KEY} \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
gnupg \
|
|
lsb-release \
|
|
curl \
|
|
tar \
|
|
unzip \
|
|
apt-transport-https \
|
|
ca-certificates \
|
|
sudo \
|
|
gpg-agent \
|
|
software-properties-common \
|
|
build-essential \
|
|
zlib1g-dev \
|
|
zstd \
|
|
gettext \
|
|
libcurl4-openssl-dev \
|
|
inetutils-ping \
|
|
jq \
|
|
wget \
|
|
dirmngr \
|
|
openssh-client \
|
|
locales \
|
|
python3-pip \
|
|
python3-setuptools \
|
|
python3 \
|
|
dumb-init \
|
|
nodejs \
|
|
rsync \
|
|
gosu \
|
|
&& DPKG_ARCH="$(dpkg --print-architecture)" \
|
|
&& LSB_RELEASE_CODENAME="$(lsb_release --codename | cut -f2)" \
|
|
&& sed -e 's/Defaults.*env_reset/Defaults env_keep = "HTTP_PROXY HTTPS_PROXY NO_PROXY FTP_PROXY http_proxy https_proxy no_proxy ftp_proxy"/' -i /etc/sudoers \
|
|
&& echo deb http://ppa.launchpad.net/git-core/ppa/ubuntu $([[ $(grep -E '^ID=' /etc/os-release | sed 's/.*=//g') == "ubuntu" ]] && (grep VERSION_CODENAME /etc/os-release | sed 's/.*=//g') || echo bionic) main>/etc/apt/sources.list.d/git-core.list \
|
|
&& apt-get update \
|
|
&& ( apt-get install -y --no-install-recommends git || apt-get install -t stable -y --no-install-recommends git || apt-get install -y --no-install-recommends git=1:2.33.1-0ppa1~ubuntu18.04.1 git-man=1:2.33.1-0ppa1~ubuntu18.04.1 ) \
|
|
&& ( [[ $(apt-cache search -n liblttng-ust0 | awk '{print $1}') == "liblttng-ust0" ]] && apt-get install -y --no-install-recommends liblttng-ust0 || : ) \
|
|
&& ( [[ $(apt-cache search -n liblttng-ust1 | awk '{print $1}') == "liblttng-ust1" ]] && apt-get install -y --no-install-recommends liblttng-ust1 || : ) \
|
|
&& ( ( curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip -d /tmp/ && /tmp/aws/install && rm awscliv2.zip) || pip3 install awscli ) \
|
|
&& ( curl -s "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${DPKG_ARCH}-v${GIT_LFS_VERSION}.tar.gz" -L -o /tmp/lfs.tar.gz && tar -xzf /tmp/lfs.tar.gz -C /tmp && /tmp/git-lfs-${GIT_LFS_VERSION}/install.sh && rm -rf /tmp/lfs.tar.gz /tmp/git-lfs-${GIT_LFS_VERSION}) \
|
|
# Determine the Distro name (Debian, Ubuntu, etc)
|
|
&& distro=$(lsb_release -is | awk '{print tolower($0)}') \
|
|
# Determine the Distro version (bullseye, xenial, etc)
|
|
# Note: sid is aliased to bullseye, because Docker doesn't have a matching apt repo
|
|
&& mkdir -p /etc/apt/keyrings \
|
|
&& ( curl -fsSL https://download.docker.com/linux/${distro}/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg ) \
|
|
&& version=$(lsb_release -cs | awk '{gsub("sid", "bullseye"); print $0}') \
|
|
&& ( echo "deb [arch=${DPKG_ARCH} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${distro} ${version} stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null ) \
|
|
&& apt-get update \
|
|
&& apt-get install -y docker-ce docker-ce-cli containerd.io --no-install-recommends --allow-unauthenticated \
|
|
&& ( [[ $(lscpu -J | jq -r '.lscpu[] | select(.field == "Vendor ID:") | .data') == "ARM" ]] && echo "Not installing docker-compose. See https://github.com/docker/compose/issues/6831" || ( curl -sL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose ) ) \
|
|
&& ( [[ "${LSB_RELEASE_CODENAME}" == "focal" ]] && ( echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list && curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key" | apt-key add - && apt-get update) || : ) \
|
|
&& ( [[ "${LSB_RELEASE_CODENAME}" == "focal" || "${LSB_RELEASE_CODENAME}" == "jammy" || "${LSB_RELEASE_CODENAME}" == "sid" || "${LSB_RELEASE_CODENAME}" == "bullseye" ]] && apt-get install -y --no-install-recommends podman buildah skopeo || : ) \
|
|
&& ( [[ "${LSB_RELEASE_CODENAME}" == "jammy" ]] && echo "Ubuntu Jammy is marked as beta. Please see https://github.com/actions/virtual-environments/issues/5490" || : ) \
|
|
&& GH_CLI_INSTALL_FILE="/tmp/gh-$$.deb" && curl -sSLo "${GH_CLI_INSTALL_FILE}" "https://github.com$(curl -sSL "https://github.com/cli/cli/releases/latest" | grep -Po "(?<=href=\")/cli/cli/releases/download/[^\"]*${DPKG_ARCH}[.]deb(?=\")")" && apt -y install "${GH_CLI_INSTALL_FILE}" \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& rm -rf /tmp/* \
|
|
&& groupadd -g 121 runner \
|
|
&& useradd -mr -d /home/runner -u 1001 -g 121 runner \
|
|
&& usermod -aG sudo runner \
|
|
&& usermod -aG docker runner \
|
|
&& echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|