Files
runner-images/dockerfiles/ubuntu.dockerfile
T
fristy 4ac07da223
build / build (26.10) (pull_request) Successful in 3m4s
build / build (24.04) (pull_request) Successful in 3m4s
build / build (26.04) (pull_request) Successful in 3m4s
chore: let Renovate merge its own updates
minor, patch, pin and digest updates automerge once the branch is green and the
release is two days old. major and breaking updates still wait for a human:
matchIsBreaking turns automerge back off, and majors are not in the automerge
rule at all.

trivy skips the release-age wait because scanner fixes matter immediately, and
OSV alerts automerge with no age check either.

tea now resolves through gitea-releases: github.com/gitea/tea does not exist, so
every run reported a lookup failure for it. nfpm moves to 2.49.0, which Renovate
would have held back for another day.

Signed-off-by: fristyxd <gpg@fristy.dev>
2026-11-12 12:42:23 +03:00

255 lines
11 KiB
Docker

# syntax=docker/dockerfile:1
#
# Ubuntu runner image for our Gitea Actions runners.
#
# Every tool a workflow would otherwise download on each run is baked in:
# node, pnpm, corepack, python, docker CLI + buildx + compose, git, jq, yq, tea,
# go, rust (with the musl target and cargo-zigbuild), gh, trivy, nfpm and zig.
# Actions/setup-node finds node in RUNNER_TOOL_CACHE, so it never hits GitHub.
ARG BASE_IMAGE_TAG=26.10
FROM buildpack-deps:${BASE_IMAGE_TAG}
ARG TARGETARCH
ARG BASE_IMAGE_TAG
# renovate: datasource=node-version depName=node
ARG NODE_VERSION=26.13.1
# renovate: datasource=npm depName=pnpm
ARG PNPM_VERSION=12.18.0
# renovate: datasource=npm depName=corepack
ARG COREPACK_VERSION=0.36.0
# renovate: datasource=github-releases depName=mikefarah/yq
ARG YQ_VERSION=v4.54.3
# renovate: datasource=gitea-releases depName=gitea/tea
ARG TEA_VERSION=0.16.0
# renovate: datasource=golang-version depName=golang
ARG GO_VERSION=1.27.4
# renovate: datasource=github-releases depName=cli/cli
ARG GH_VERSION=2.103.3
# renovate: datasource=github-releases depName=aquasecurity/trivy
ARG TRIVY_VERSION=0.76.2
# renovate: datasource=github-releases depName=goreleaser/nfpm
ARG NFPM_VERSION=2.49.0
# renovate: datasource=github-releases depName=rust-cross/cargo-zigbuild
ARG CARGO_ZIGBUILD_VERSION=0.24.1
# Renovate has no datasource for zig; bump from https://ziglang.org/download/index.json by hand.
ARG ZIG_VERSION=0.17.0
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
ImageOS=ubuntu${BASE_IMAGE_TAG%%.*} \
IMAGE_OS=ubuntu${BASE_IMAGE_TAG%%.*} \
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache \
RUNNER_TOOL_CACHE=/opt/hostedtoolcache \
USER=root \
RUNNER_USER=root \
PIPX_HOME=/opt/pipx \
PIPX_BIN_DIR=/opt/pipx_bin \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:/opt/pipx_bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
RUN case "${TARGETARCH}" in \
amd64) arch=x86_64; goarch=amd64; node_arch=x64; gh_arch=amd64; trivy_arch=64bit; zig_arch=x86_64 ;; \
arm64) arch=aarch64; goarch=arm64; node_arch=arm64; gh_arch=arm64; trivy_arch=ARM64; zig_arch=aarch64 ;; \
*) echo "unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& echo "${arch}" > /tmp/arch \
&& echo "${goarch}" > /tmp/goarch \
&& echo "${node_arch}" > /tmp/node_arch \
&& echo "${gh_arch}" > /tmp/gh_arch \
&& echo "${trivy_arch}" > /tmp/trivy_arch \
&& echo "${zig_arch}" > /tmp/zig_arch
# Base packages. buildpack-deps already brings compilers, curl, git and the usual libraries.
RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
file \
git-lfs \
gnupg \
iproute2 \
jq \
less \
lsb-release \
musl-tools \
netcat-openbsd \
patchelf \
pigz \
pipx \
pkg-config \
python3-dev \
python3-pip \
python3-venv \
rsync \
shellcheck \
software-properties-common \
sqlite3 \
sudo \
tree \
unzip \
wget \
xz-utils \
zip \
zstd \
&& . /etc/os-release \
&& install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \
&& echo "deb [arch=${TARGETARCH} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
docker-buildx-plugin \
docker-ce-cli \
docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/docker.list /etc/apt/keyrings/docker.asc \
&& git config --system --add safe.directory '*' \
&& git lfs install --system \
&& pipx install yamllint \
&& chmod -R 777 /opt/pipx /opt/pipx_bin \
&& rm -rf ~/.cache
# Node goes into the tool cache for setup-node and is hard linked into /usr/local,
# so a shared tool-cache volume cannot hide it.
RUN node_arch="$(cat /tmp/node_arch)" \
&& cd /tmp \
&& base_url="https://nodejs.org/dist/v${NODE_VERSION}" \
&& curl -fsSLO "${base_url}/SHASUMS256.txt" \
&& tarball="node-v${NODE_VERSION}-linux-${node_arch}.tar.xz" \
&& curl -fsSLO "${base_url}/${tarball}" \
&& grep " ${tarball}\$" SHASUMS256.txt | sha256sum -c - \
&& node_dir="/opt/hostedtoolcache/node/${NODE_VERSION}/${node_arch}" \
&& mkdir -p "${node_dir}" \
&& tar -xJf "${tarball}" -C "${node_dir}" --strip-components=1 --no-same-owner \
&& touch "${node_dir}.complete" \
&& chmod 777 /opt/hostedtoolcache /opt/hostedtoolcache/node \
&& cp -al "${node_dir}/bin" "${node_dir}/include" "${node_dir}/lib" "${node_dir}/share" /usr/local/ \
&& rm -f "${tarball}" SHASUMS256.txt \
&& node --version \
&& npm install -g "pnpm@${PNPM_VERSION}" "corepack@${COREPACK_VERSION}" \
&& rm -rf ~/.npm \
&& pnpm --version \
&& corepack --version
RUN arch="$(cat /tmp/arch)" \
&& cd /tmp \
&& base_url="https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}" \
&& curl -fsSLO "${base_url}/yq_linux_${TARGETARCH}" \
&& curl -fsSL "${base_url}/checksums-bsd" | grep "^SHA256 (yq_linux_${TARGETARCH})" | sha256sum -c - \
&& install -m 0755 "yq_linux_${TARGETARCH}" /usr/bin/yq \
&& rm -f "yq_linux_${TARGETARCH}" \
&& yq --version
RUN cd /tmp \
&& base_url="https://dl.gitea.com/tea/${TEA_VERSION}" \
&& binary="tea-${TEA_VERSION}-linux-${TARGETARCH}" \
&& curl -fsSLO "${base_url}/${binary}" \
&& curl -fsSL "${base_url}/${binary}.sha256" | sha256sum -c - \
&& install -m 0755 "${binary}" /usr/local/bin/tea \
&& rm -f "${binary}" \
&& tea --version
RUN goarch="$(cat /tmp/goarch)" \
&& cd /tmp \
&& tarball="go${GO_VERSION}.linux-${goarch}.tar.gz" \
&& curl -fsSLO "https://go.dev/dl/${tarball}" \
&& curl -fsSL "https://go.dev/dl/?mode=json&include=all" -o go.json \
&& sha="$(jq -r --arg v "go${GO_VERSION}" --arg f "${tarball}" '.[] | select(.version == $v) | .files[] | select(.filename == $f) | .sha256' go.json)" \
&& echo "${sha} ${tarball}" | sha256sum -c - \
&& tar -C /usr/local -xzf "${tarball}" \
&& rm -f "${tarball}" go.json \
&& ln -sf /usr/local/go/bin/go /usr/local/bin/go \
&& ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt \
&& go version
RUN gh_arch="$(cat /tmp/gh_arch)" \
&& cd /tmp \
&& tarball="gh_${GH_VERSION}_linux_${gh_arch}.tar.gz" \
&& curl -fsSLO "https://github.com/cli/cli/releases/download/v${GH_VERSION}/${tarball}" \
&& curl -fsSL "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_checksums.txt" -o checksums.txt \
&& grep " ${tarball}\$" checksums.txt | sha256sum -c - \
&& tar -xzf "${tarball}" \
&& install -m 0755 "gh_${GH_VERSION}_linux_${gh_arch}/bin/gh" /usr/local/bin/gh \
&& rm -rf "${tarball}" checksums.txt "gh_${GH_VERSION}_linux_${gh_arch}" \
&& gh --version
RUN trivy_arch="$(cat /tmp/trivy_arch)" \
&& cd /tmp \
&& tarball="trivy_${TRIVY_VERSION}_Linux-${trivy_arch}.tar.gz" \
&& curl -fsSLO "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/${tarball}" \
&& curl -fsSL "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_checksums.txt" -o checksums.txt \
&& grep " ${tarball}\$" checksums.txt | sha256sum -c - \
&& tar -xzf "${tarball}" -C /tmp trivy \
&& install -m 0755 /tmp/trivy /usr/local/bin/trivy \
&& rm -f "${tarball}" checksums.txt /tmp/trivy \
&& trivy --version
RUN arch="$(cat /tmp/arch)" \
&& pkg_arch="$([[ "${TARGETARCH}" == "amd64" ]] && echo x86_64 || echo arm64)" \
&& cd /tmp \
&& tarball="nfpm_${NFPM_VERSION}_Linux_${pkg_arch}.tar.gz" \
&& curl -fsSLO "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/${tarball}" \
&& curl -fsSL "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/checksums.txt" -o checksums.txt \
&& grep " ${tarball}\$" checksums.txt | sha256sum -c - \
&& tar -xzf "${tarball}" nfpm \
&& install -m 0755 nfpm /usr/local/bin/nfpm \
&& rm -f "${tarball}" checksums.txt nfpm \
&& nfpm --version
RUN zig_arch="$(cat /tmp/zig_arch)" \
&& cd /tmp \
&& info="$(curl -fsSL https://ziglang.org/download/index.json)" \
&& tarball_url="$(echo "${info}" | jq -r --arg v "${ZIG_VERSION}" --arg k "${zig_arch}-linux" '.[$v][$k].tarball')" \
&& shasum="$(echo "${info}" | jq -r --arg v "${ZIG_VERSION}" --arg k "${zig_arch}-linux" '.[$v][$k].shasum')" \
&& [ -n "${tarball_url}" ] && [ "${tarball_url}" != "null" ] || { echo "zig ${ZIG_VERSION} not found for ${zig_arch}-linux" >&2; exit 1; } \
&& tarball="$(basename "${tarball_url}")" \
&& curl -fsSLO "${tarball_url}" \
&& echo "${shasum} ${tarball}" | sha256sum -c - \
&& mkdir -p /opt/zig \
&& tar -xJf "${tarball}" -C /opt/zig --strip-components=1 \
&& ln -sf /opt/zig/zig /usr/local/bin/zig \
&& rm -f "${tarball}" \
&& zig version
RUN arch="$(cat /tmp/arch)" \
&& curl -fsSL "https://static.rust-lang.org/rustup/dist/${arch}-unknown-linux-gnu/rustup-init" -o /tmp/rustup-init \
&& chmod +x /tmp/rustup-init \
&& /tmp/rustup-init -y --profile minimal --default-toolchain stable --no-modify-path \
&& rm -f /tmp/rustup-init \
&& rustup target add aarch64-unknown-linux-musl \
&& curl --proto '=https' --tlsv1.2 -LsSf "https://github.com/rust-cross/cargo-zigbuild/releases/download/v${CARGO_ZIGBUILD_VERSION}/cargo-zigbuild-installer.sh" | sh \
&& rustc --version \
&& cargo --version \
&& cargo zigbuild --help > /dev/null
# Runner plumbing: work dir, ssh known hosts, tool cache permissions.
RUN mkdir -m 0777 -p /github /opt/hostedtoolcache \
&& mkdir -m 0700 -p ~/.ssh \
&& ssh-keyscan -t rsa,ecdsa,ed25519 github.com gitea.com >> /etc/ssh/ssh_known_hosts \
&& rm -f /tmp/arch /tmp/goarch /tmp/node_arch /tmp/gh_arch /tmp/trivy_arch /tmp/zig_arch
ARG IMAGE_CREATED
ARG IMAGE_VERSION
ARG IMAGE_REVISION
ENV ImageVersion=${IMAGE_VERSION}
LABEL org.opencontainers.image.created="${IMAGE_CREATED}" \
org.opencontainers.image.authors="fristy" \
org.opencontainers.image.url="https://git.fristy.net/actions/runner-images" \
org.opencontainers.image.documentation="https://git.fristy.net/actions/runner-images/src/branch/main/README.md" \
org.opencontainers.image.source="https://git.fristy.net/actions/runner-images" \
org.opencontainers.image.version="${IMAGE_VERSION}" \
org.opencontainers.image.revision="${IMAGE_REVISION}" \
org.opencontainers.image.vendor="fristy" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="Gitea Actions runner images" \
org.opencontainers.image.description="Runner images for our fristea actions runners."
WORKDIR /github