commit 2f4a68602b8a9f68006092dc9e25565ac01959ff Author: fristyxd Date: Sat Oct 31 14:27:41 2026 +0300 feat: runner images for Ubuntu 24.04, 26.04 and 26.10 Images built on buildpack-deps with every tool our workflows used to download on each run baked in: node 26 (installed into RUNNER_TOOL_CACHE so setup-node never calls the GitHub API), pnpm, corepack, python3, docker CLI with buildx and compose, git with lfs, jq, yq, tea, go, rust with the musl target, cargo-zigbuild, zig, gh, trivy and nfpm. Adds the pull-request build with smoke tests, the release workflow that publishes ubuntu-24.04 / ubuntu-26.04 / ubuntu-26.10 plus the ubuntu-latest alias, Renovate annotations for every pinned version, and the docs: README, CHANGELOG (Keep a Changelog 1.1.0), SECURITY with the security@fristy.dev PGP key, CONTRIBUTING (Conventional Branch, SemVer), CODE_OF_CONDUCT and MIT LICENSE. diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..a42d9e4 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,67 @@ +name: build + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# Builds, scans and smoke tests the images without publishing anything. + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 120 + strategy: + fail-fast: false + matrix: + base: ["26.10", "26.04", "24.04"] + env: + IMAGE: runner-images-test:${{ github.run_id }}-${{ matrix.base }} + TRIVY: ghcr.io/aquasecurity/trivy:0.76.1 + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Build ${{ matrix.base }} amd64 + uses: docker/build-push-action@v7 + with: + context: . + file: dockerfiles/ubuntu.dockerfile + platforms: linux/amd64 + pull: true + push: false + load: true + build-args: | + BASE_IMAGE_TAG=${{ matrix.base }} + tags: ${{ env.IMAGE }} + + - name: Smoke test ${{ matrix.base }} + run: docker run --rm -i "${IMAGE}" bash -s -- ${{ matrix.base }} < tests/default.sh + + - name: Export the image for scanning + run: docker save "${IMAGE}" -o /tmp/image.tar + + - name: Scan ${{ matrix.base }} for CRITICAL vulnerabilities + run: | + docker run --rm -v /tmp:/scan "${TRIVY}" image --input /scan/image.tar \ + --quiet --scanners vuln --severity CRITICAL --ignore-unfixed --exit-code 1 --no-progress + + - name: Report HIGH vulnerabilities for ${{ matrix.base }} + if: always() + run: | + docker run --rm -v /tmp:/scan "${TRIVY}" image --input /scan/image.tar \ + --quiet --scanners vuln --severity HIGH --ignore-unfixed --exit-code 1 --no-progress \ + --format table || echo "HIGH findings present; not blocking the pull request" + + - name: Remove test image + if: always() + run: docker image rm -f "${IMAGE}" diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..c3e6f08 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,114 @@ +name: release + +on: + push: + branches: [main] + tags: ["v*"] + schedule: + - cron: "0 3 1 * *" + workflow_dispatch: + +permissions: + contents: read + packages: write + +concurrency: + group: release + cancel-in-progress: false + +env: + REGISTRY: git.fristy.net + IMAGE: git.fristy.net/actions/runner-images + TRIVY: ghcr.io/aquasecurity/trivy:0.76.1 + +jobs: + meta: + runs-on: ubuntu-latest + outputs: + created: ${{ steps.meta.outputs.created }} + version: ${{ steps.meta.outputs.version }} + steps: + - name: Get meta + id: meta + run: | + echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" + if [ "${GITHUB_REF_TYPE}" = "tag" ]; then + version="${GITHUB_REF_NAME}" + else + version="v0.0.0-dev.$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" + fi + echo "version=${version}" >> "$GITHUB_OUTPUT" + + publish: + needs: meta + runs-on: ubuntu-latest + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: + include: + - base: "24.04" + tags: ubuntu-24.04 + - base: "26.04" + tags: ubuntu-26.04 + - base: "26.10" + tags: ubuntu-26.10,ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Build ${{ matrix.base }} + uses: docker/build-push-action@v7 + with: + context: . + file: dockerfiles/ubuntu.dockerfile + platforms: linux/amd64 + pull: true + push: false + load: true + tags: ${{ env.IMAGE }}:ubuntu-${{ matrix.base }} + cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache-${{ matrix.base }} + cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache-${{ matrix.base }},mode=max + build-args: | + BASE_IMAGE_TAG=${{ matrix.base }} + IMAGE_CREATED=${{ needs.meta.outputs.created }} + IMAGE_VERSION=${{ needs.meta.outputs.version }} + IMAGE_REVISION=${{ github.sha }} + + - name: Smoke test ${{ matrix.base }} + run: docker run --rm -i "${IMAGE}:ubuntu-${{ matrix.base }}" bash -s -- ${{ matrix.base }} < tests/default.sh + + - name: Export the image for scanning + run: docker save "${IMAGE}:ubuntu-${{ matrix.base }}" -o /tmp/image.tar + + - name: Scan ${{ matrix.base }} for CRITICAL vulnerabilities + run: | + docker run --rm -v /tmp:/scan "${TRIVY}" image --input /scan/image.tar \ + --quiet --scanners vuln --severity CRITICAL --ignore-unfixed --exit-code 1 --no-progress + + - name: Report HIGH vulnerabilities for ${{ matrix.base }} + if: always() + run: | + docker run --rm -v /tmp:/scan "${TRIVY}" image --input /scan/image.tar \ + --quiet --scanners vuln --severity HIGH --ignore-unfixed --exit-code 1 --no-progress \ + --format table || echo "HIGH findings present; recorded above, not blocking the release" + + - name: Log in to the registry + run: | + token="${{ secrets.REGISTRY_TOKEN }}" + [ -n "$token" ] || { echo "REGISTRY_TOKEN secret is missing" >&2; exit 1; } + echo "$token" | docker login "$REGISTRY" -u "${{ secrets.REGISTRY_USERNAME || github.actor }}" --password-stdin + + - name: Push ${{ matrix.base }} + run: | + set -euo pipefail + printf '%s\n' "${{ matrix.tags }}" | tr ',' '\n' | while read -r tag; do + [ -n "${tag}" ] || continue + docker tag "${IMAGE}:ubuntu-${{ matrix.base }}" "${IMAGE}:${tag}" + docker push "${IMAGE}:${tag}" + done + docker tag "${IMAGE}:ubuntu-${{ matrix.base }}" "${IMAGE}:${{ needs.meta.outputs.version }}-${{ matrix.base }}" + docker push "${IMAGE}:${{ needs.meta.outputs.version }}-${{ matrix.base }}" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f2fafd4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +All notable changes to this project are documented in this file. + +The format is based on [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0] - 2026-10-31 + +### Added + +- Runner images for Ubuntu 24.04, 26.04 and 26.10, built on `buildpack-deps`. +- `ubuntu-latest` as an alias for the newest base (26.10). +- Node 26.13.0 installed into `RUNNER_TOOL_CACHE` and hard linked into `/usr/local`, + so `actions/setup-node` never downloads it from the GitHub API. +- pnpm, corepack and npm installed globally, removing `pnpm/action-setup` downloads. +- Docker CLI with the buildx and compose plugins. +- git and git-lfs, jq, yq, tea, shellcheck, sqlite3, yamllint. +- Go, Rust (rustup) with the `aarch64-unknown-linux-musl` target, cargo-zigbuild and zig. +- gh, trivy and nfpm, so release jobs stop fetching them per run. +- `tests/default.sh` smoke test that asserts every baked tool is present and that the + tool cache is writable. +- `build.yaml` (pull requests, no publishing) and `release.yaml` (publish on `main`, + on `v*` tags, monthly, or on demand). + +[Unreleased]: https://git.fristy.net/actions/runner-images/compare/v1.0.0...main +[1.0.0]: https://git.fristy.net/actions/runner-images/releases/tag/v1.0.0 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..69b43b1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,57 @@ +# Contributor Code of Conduct + +## Our pledge + +We as members, contributors, and maintainers pledge to make participation in this +project a harassment-free experience for everyone, regardless of age, body size, +visible or invisible disability, ethnicity, sex characteristics, gender identity +and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our standards + +Examples of behaviour that contributes to a positive environment: + +- demonstrating empathy and kindness toward other people +- being respectful of differing opinions, viewpoints, and experiences +- giving and gracefully accepting constructive feedback +- accepting responsibility and apologising to those affected by our mistakes +- focusing on what is best for the project and the people running it + +Examples of unacceptable behaviour: + +- sexualised language or imagery, and sexual attention or advances of any kind +- trolling, insulting or derogatory comments, and personal or political attacks +- public or private harassment +- publishing others' private information, such as a physical or email address, + without their explicit permission +- other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement + +Maintainers are responsible for clarifying and enforcing these standards. They +may remove, edit, or reject comments, commits, code, issues, and other +contributions that do not align with this Code of Conduct, and will communicate +reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies in all project spaces, and also applies when an +individual is officially representing the project in public spaces. + +## Reporting + +Report abusive, harassing, or otherwise unacceptable behaviour to the maintainer +at https://git.fristy.net/actions. All complaints will be reviewed and investigated +promptly and fairly. Maintainers are obligated to respect the privacy and security +of the reporter. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d84f2bb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,78 @@ +# Contributing + +Thanks for taking a look. This is a personal instance, so keep changes small and +explain the why. + +## Adding or bumping a tool + +1. Add a pinned `ARG` in `dockerfiles/ubuntu.dockerfile` with a Renovate + annotation above it, for example: + + ```dockerfile + # renovate: datasource=github-releases depName=jqlang/jq + ARG JQ_VERSION=1.7.1 + ``` + +2. Install it in its own `RUN` layer, verify a checksum when the upstream + publishes one, and finish the layer with the tool's `--version` so a broken + download fails the build instead of the first workflow run. +3. Extend `tests/default.sh` so the smoke test fails when the tool disappears. +4. Open a pull request. `build.yaml` builds all three base tags and runs the + smoke test; nothing is published from a pull request. + +## Ground rules + +- **Pin everything.** No `latest` tags, no downloads without a checksum when one + is available. Renovate keeps the pins fresh. +- **One concern per layer.** It keeps the layer cache usable and makes failures + obvious. +- **Do not drop tools that workflows rely on** without changing the workflows in + the same pull request. +- **Architecture:** the build matrix is `linux/amd64`. The Dockerfile maps + `TARGETARCH` for `arm64` as well, so keep it working when you add downloads. +- **Commits:** short imperative subject, body explains the reason. Add + `Signed-off-by:` if you can (DCO-style, no CLA). + +## Branch names + +We follow [Conventional Branch](https://conventionalbranch.org/): + +``` +feat/ new image tag, new tool baked in +fix/ broken build, wrong version, checksum failure +chore/ versions, workflows, docs +docs/ README, CONTRIBUTING, SECURITY +``` + +No long-lived branches besides `main`; delete the branch after the merge. + +## Versioning + +The repository follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) +for its own releases (`vMAJOR.MINOR.PATCH` git tags, published from `release.yaml`): + +- **MAJOR** — a tag disappears, an image stops shipping a tool workflows depend on. +- **MINOR** — a new base tag, a new tool or a new cache layout. +- **PATCH** — version bumps of the tools already inside, rebuilds for base updates. + +The image tags themselves (`ubuntu-24.04`, `ubuntu-latest`, …) follow the Ubuntu +release they are built on and are not versioned. `IMAGE_VERSION` records the +SemVer tag when the build comes from a `v*` tag, otherwise +`v0.0.0-dev.`. + +Changes are recorded in [CHANGELOG.md](CHANGELOG.md), which follows +[Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). + + +## Testing locally + +```bash +docker build -f dockerfiles/ubuntu.dockerfile --build-arg BASE_IMAGE_TAG=26.10 -t runner-images:test . +docker run --rm -i runner-images:test bash -s -- 26.10 < tests/default.sh +``` + +Replace `26.10` with `26.04` or `24.04` to check the other bases. + +## Reporting problems + +Bugs and breakage: normal issue. Security problems: see [SECURITY.md](SECURITY.md). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f88cf26 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 fristy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..98987be --- /dev/null +++ b/README.md @@ -0,0 +1,96 @@ +# runner-images + +Runner images for the Gitea Actions runners of our [fristea](https://git.fristy.net/fristy/fristea) +instance at `git.fristy.net`. + +The current set is Ubuntu-based (24.04, 26.04, 26.10). The Dockerfiles are written +per base distribution, so a Debian or Alpine variant can be added later without +changing the workflow or tag layout. + +## Why we build our own + +The official Gitea runner images (`docker.gitea.com/runner-images`, built on +`buildpack-deps`) cover the generic case. Our workflows kept downloading the same +things on every single run: + +| Workflow step | What it fetched | Where from | +|---|---|---| +| `actions/setup-node` | node 26.13.0 / 22 | **GitHub API** | +| `actions/setup-python` | python 3.15 | **GitHub API** | +| `pnpm/action-setup` | pnpm 12.16.1 | npm registry | +| `dtolnay/rust-toolchain` | rustup + toolchain | static.rust-lang.org | +| release job | zig, cargo-zigbuild, nfpm | ziglang.org, GitHub | +| ci job | trivy (install.sh) | GitHub | + +The two rows marked **GitHub API** share one anonymous quota of ~60 requests per +hour per IP. Several CI runs in the same hour exhausted it and jobs started dying +inside `Setup Node` before anything was compiled. Baking the tools into the image +removes the downloads entirely, so the quota no longer matters. + +Differences from `gitea/runner-images`: + +- node 26 (the image tag we run) instead of node 24, plus pnpm and corepack +- go, rust with the `aarch64-unknown-linux-musl` target, cargo-zigbuild and zig +- gh, trivy and nfpm +- `ubuntu-26.04` and `ubuntu-26.10` next to `ubuntu-24.04` +- no slim or full flavour yet + +## What is inside + +| Tool | Notes | +|---|---| +| node 26.13.0 | installed into `RUNNER_TOOL_CACHE` and hard linked into `/usr/local`, so `setup-node` never downloads it | +| npm, pnpm, corepack | global installs on top of node | +| python3 + pip + pipx | `yamllint` comes from pipx | +| docker CLI + buildx + compose plugin | jobs talk to the host daemon through the mounted socket | +| git + git-lfs, jq, yq, tea, shellcheck, sqlite3 | the usual suspects | +| go, rust (rustup), cargo-zigbuild, zig | cross builds for `aarch64-unknown-linux-musl` | +| gh, trivy, nfpm | release tooling | + +Versions are pinned as `ARG`s with `# renovate:` annotations, so Renovate bumps +them and the image stays reproducible. + +## Tags + +| Tag | Base | +|---|---| +| `ubuntu-latest` | Ubuntu 26.10 | +| `ubuntu-26.10` | Ubuntu 26.10 | +| `ubuntu-26.04` | Ubuntu 26.04 LTS | +| `ubuntu-24.04` | Ubuntu 24.04 LTS | + +Images are `linux/amd64` only for now. The Dockerfile already handles `arm64` +(`TARGETARCH`), it is just not in the build matrix. + +The repository itself is released with [Semantic Versioning](https://semver.org/spec/v2.0.0.html) +tags; changes land in [CHANGELOG.md](CHANGELOG.md) following +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Image tags follow the +Ubuntu release instead and are not versioned. + +## Using an image + +Map a label to the image in the runner config (`/config.yaml`): + +```yaml +runner: + labels: + - "ubuntu-latest:docker://git.fristy.net/actions/runner-images:ubuntu-latest" + - "ubuntu-26.04:docker://git.fristy.net/actions/runner-images:ubuntu-26.04" +``` + +Then `runs-on: ubuntu-latest` picks it up. Workflows that used to call +`actions/setup-node` can drop it: node is already on `PATH`. + +## Building locally + +```bash +docker build -f dockerfiles/ubuntu.dockerfile \ + --build-arg BASE_IMAGE_TAG=26.10 \ + -t runner-images:ubuntu-26.10 . + +docker run --rm -i runner-images:ubuntu-26.10 bash -s -- 26.10 < tests/default.sh +``` + +`build.yaml` does exactly this for every tag in the matrix on pull requests; +`release.yaml` publishes to `git.fristy.net/actions/runner-images` on `main`, +on `v*` tags, monthly, or on demand. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..cbcf76c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,97 @@ +# Reporting security issues + +If you discover a security issue in these images or their build configuration, +please report it privately and right away. + +## Supported versions + +Only the images currently published under the tags listed in the [README](README.md) +receive fixes. There is no long-term support for old builds: the fix path is a +rebuilt image, and a rebuild is a pull request. + +## Reporting a vulnerability + +Please **do not** open a public issue. + +- E-mail `security@fristy.dev`. Encrypt the report with the GPG key below if it + contains anything sensitive. +- Or open a confidential issue at + https://git.fristy.net/actions/runner-images/issues and mark it confidential. + +Include the image tag, the tool and version, and a reproduction if you have one. +If the report turns out to be a duplicate, you will be credited in the original. + +Please do not use an LLM to write the report: it is meant for a person to read. +If you used an LLM to find the issue, say so and verify the finding yourself +before sending it. + +## Protecting security information + +Due to the sensitive nature of security information, you can use the GPG public +key below to encrypt your mail body. + +``` +Key ID: 111D9D904C11D2A2 +Key Type: RSA +Expires: 10/18/2028 +Key Size: 4096/4096 +Fingerprint: 859C DA3B ACA7 CAD6 C997 B5B6 111D 9D90 4C11 D2A2 +``` + +UserID: fristy security + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGrWUBEBEADlEoZPUpxzsmTgbc001VvqfqiYmwIBP3l5Urj56klnxpLpfrlz +PYfyFUHotqpZWOVDZ3Oa++2I0pTaGt6ZfNQkeng+7uNHISwS4zspxPxxl1mw/52X +r46ZGp4volGsG0frkaWcdBL1BKmJiOoo4fbCFgRdObw8ooMLtIoUmhQUjUoXMI0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aO6ynytbJl7W2ER2dkEwR0qIFAmrWUCgbFIAAAAAABAAObWFu +dTIsMi41KzEuMTIsMiwxAhsMBQkDwmcAAAoJEBEdnZBMEdKipWgQAMdJvCJPLMX6 +Vl6A5aaNFrQTw+r6oztPhyPwFHiV6QpTCzpBuxdkHrUcYJoPDOj57/wZfVL6A95V +04DOc+SFdsgWeKiw0h93zJDKSkYYMvYlbaHgs7C7bC1kq8NBGiPx2DgWvWGgBKXq +bBYeX60F+GaVk7BxUvVwZFTHWB4R8BbLU94LNFzoyfNarw4Eton2iN1yRSo0x4RQ +X7C+Damg18rzL7hg1sMs1Mh7za3q6hULx+xSjh6BuKpzzkCleHumkqAB31caIs5g +Vyj0yS/zyxMCBSdbtyMnMpfqGBh/BvUQoibrrscTSttT3d2HBGtJGXjWMWVfvQqx +mJkFywfKp51/m57SaY3yxYcvucMNe4ONkkimfB5ZwB4iyTly1hwOVdu8siDEaDb+ +2IpBNjwK7Yjqa0p4ICygHqueJCt5VzXtAcbNiHP80MQhHbI5rfhMzJTjDA/iV5Me +09TEF7nhvbLye251GXomPY+0Nq0vBQA85+oqz6+q+Ukn3zA67PcxgPlBT+Q7hCWg +DaSwz5A3XtsGbWUNm+1whzoAMrMix4CzMdrmvf0U0iKQ15pj/cVuglwHii2i3cIf +bMpyeuVls8VVI7RjuFv0mnU5m0aqLJmf0lTNFSLxTcekTak1G+IYngc//Q/W+wDm +Qh8xAzicTfVHUgvWflysXr9jWA11QBCA +=eLZT +-----END PGP PUBLIC KEY BLOCK----- +``` diff --git a/dockerfiles/ubuntu.dockerfile b/dockerfiles/ubuntu.dockerfile new file mode 100644 index 0000000..cc8569a --- /dev/null +++ b/dockerfiles/ubuntu.dockerfile @@ -0,0 +1,254 @@ +# 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.0 +# renovate: datasource=npm depName=pnpm +ARG PNPM_VERSION=12.16.1 +# renovate: datasource=npm depName=corepack +ARG COREPACK_VERSION=0.36.0 +# renovate: datasource=github-releases depName=mikefarah/yq +ARG YQ_VERSION=v4.54.1 +# renovate: datasource=github-releases depName=gitea/tea +ARG TEA_VERSION=0.16.0 +# renovate: datasource=go depName=golang/go +ARG GO_VERSION=1.27.3 +# 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.1 +# renovate: datasource=github-releases depName=goreleaser/nfpm +ARG NFPM_VERSION=2.48.0 +# renovate: datasource=github-releases depName=rust-cross/cargo-zigbuild +ARG CARGO_ZIGBUILD_VERSION=0.24.0 +# renovate: datasource=ziglang depName=zig +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" -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 diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..8b8d561 --- /dev/null +++ b/renovate.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:recommended"], + "minimumReleaseAge": "2 days", + "packageRules": [ + { + "matchManagers": ["dockerfile"], + "groupName": "runner tool versions" + }, + { + "matchDepNames": ["node", "node-version"], + "matchUpdateTypes": ["major"], + "enabled": false + } + ] +} diff --git a/tests/default.sh b/tests/default.sh new file mode 100644 index 0000000..8feb8b5 --- /dev/null +++ b/tests/default.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# Smoke test for the runner image. Runs inside the built image: +# docker run --rm -i bash -s -- < tests/default.sh +# shellcheck disable=SC1091,SC2016 +set -euo pipefail + +version="${1:?usage: default.sh }" + +. /etc/os-release +[[ "${VERSION_ID}" == "${version}" ]] || { + echo "expected Ubuntu ${version}, got ${VERSION_ID}" >&2 + exit 1 +} + +# The runner relies on these to detect the image and the tool cache. +[[ "${ImageOS}" == "ubuntu${version%%.*}" ]] || { echo "bad ImageOS: ${ImageOS}" >&2; exit 1; } +[[ "${IMAGE_OS}" == "ubuntu${version%%.*}" ]] || { echo "bad IMAGE_OS: ${IMAGE_OS}" >&2; exit 1; } +[[ "${AGENT_TOOLSDIRECTORY}" == /opt/hostedtoolcache ]] +[[ "${RUNNER_TOOL_CACHE}" == /opt/hostedtoolcache ]] +[[ "${USER}" == root ]] + +# setup-node must find a complete node tool-cache entry, otherwise it downloads node. +node_dir="$(echo /opt/hostedtoolcache/node/*/x64)" +[[ -f "${node_dir}.complete" ]] || { echo "no complete node tool cache entry" >&2; exit 1; } +test -w "${node_dir}" + +su nobody -s /bin/sh -c 'test -w /opt/hostedtoolcache && test -w /opt/pipx/venvs && test -w /opt/pipx_bin' +test -d /github +git config --system --get-all safe.directory | grep -qxF '*' + +# Everything below is what workflows used to download on every run. +node --version +npm --version +pnpm --version +corepack --version +python3 --version +docker --version +docker buildx version +docker compose version +git --version +git lfs version +jq --version +yq --version +tea --version +go version +rustc --version +cargo --version +cargo zigbuild --help > /dev/null +rustup target list --installed | grep -qx 'aarch64-unknown-linux-musl' +zig version +gh --version +trivy --version +nfpm --version +yamllint --version + +echo "smoke test passed for Ubuntu ${version}"