Jens Segers on

ARM-Powered GitHub Action Runners using the Raspberry Pi 5

While working on a side project recently, I reached the free tier limit for GitHub Action minutes. For this project, I created multiple Docker images for the ARM architecture to be deployed as AWS Lambda functions. This prompted me to explore self-hosted runners.

Conveniently, I had a Raspberry Pi 5 lying around - a model with 8GB of RAM and an ARM processor. The ARM architecture was a perfect fit for this experiment since it eliminated the need to cross-compile Docker images to another architecture.

The Setup

I used Ansible to automate the setup process and deployed one GitHub runner for each CPU core (four in total for the Raspberry Pi 5), utilizing the myoung34/github-runner Docker image. Below is the Ansible playbook I used to configure the runners.

- name: Create runner work directories
  file:
      path: '/docker/github-runner/runner-{{ item }}'
      state: directory
      mode: '0755'
  with_items: '{{ range(1, github_runner_count + 1) | list }}'

- name: Start GitHub runner containers
  docker_container:
      name: 'github-runner-{{ item }}'
      image: myoung34/github-runner:ubuntu-noble
      restart_policy: unless-stopped
      volumes:
          - '/var/run/docker.sock:/var/run/docker.sock'
          - '/docker/github-runner/runner-{{ item }}:/tmp/runner/work'
      env:
          REPO_URL: 'https://github.com/your-repository'
          RUNNER_TOKEN: '{{ github_access_token }}'
          RUNNER_NAME: 'runner-{{ item }}'
          RUNNER_WORKDIR: '/tmp/runner/work'
  with_items: '{{ range(1, github_runner_count + 1) | list }}'

If you prefer using Docker Compose or systemd, you can find several usage examples at https://github.com/myoung34/docker-github-actions-runner/wiki/Usage.

Ensure you use the correct RUNNER_TOKEN for your organization or repository. For more information on setting up self-hosted runners, refer to https://docs.github.com/actions/hosting-your-own-runners/about-self-hosted-runners.

The build environment

Compared to the hosted GitHub runners, the myoung34/github-runner image is missing some common development tools, such as the AWS CLI. However, using Docker, you can easily extend the image to include additional tools:

FROM myoung34/github-runner:2.321.0-ubuntu-noble

RUN apt-get update && apt-get install -y \
    nodejs npm unzip curl && \
    curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && \
    unzip awscliv2.zip && \
    ./aws/install --update && \
    rm -rf awscliv2.zip aws

Results

Running self-hosted runners on the Raspberry Pi 5 has been successful. Although I didn’t conduct extensive benchmarks, I observed slightly faster builds, particularly for ARM-based Docker images.

Have you attempted to set up a self-hosted GitHub Action runner on a Raspberry Pi? I’d love to hear how it went!

Webmentions

Tweet about this blog post and you will appear below!