Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active July 4, 2023 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save higebu/b8bf07c1b99689341689ecb65d854c2f to your computer and use it in GitHub Desktop.
Save higebu/b8bf07c1b99689341689ecb65d854c2f to your computer and use it in GitHub Desktop.
cloud-init config for GitHub-hosted runner on Ubuntu 20.04
package_update: true
package_upgrade: true
groups:
- docker
- lxd
users:
- default
- name: runner
gecos: GitHub-hosted runner User
groups: docker, lxd
ssh_import_id:
- gh:higebu
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
runcmd:
- mkdir -p /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
- apt-get update
- apt-get install -y vim jq git make wget apt-transport-https ca-certificates curl software-properties-common docker-ce docker-ce-cli containerd.io docker-compose-plugin python3-pip python3-venv
- systemctl enable docker
- systemctl start docker
- mkdir -p /home/runner/actions-runner
- chown runner:runner /home/runner/actions-runner
- cd /home/runner/actions-runner
- curl -O -L https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh
- chmod +x ./create-latest-svc.sh
- RUNNER_CFG_PAT=_PAT_ bash ./create-latest-svc.sh -s _GITHUB_ORG_ -u runner -l ubuntu-focal
- pip3 install pipx
- echo 'export PATH="$PATH:/home/runner/.local/bin"' >> /home/runner/.bashrc
- echo '/home/runner/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin' > /home/runner/actions-runner/runner/.path
- chown runner:runner /home/runner/actions-runner/runner/.path
power_state:
mode: reboot
@higebu
Copy link
Author

higebu commented Aug 19, 2022

0 * * * * docker system prune -af --filter "until=1h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment