Self-hosted Github Runner

Github allows you to bring your own runners. This can be useful if you want a faster machine or are hitting limits of github runner usage.

  • Get a token for your project from via going to Settings>Actions>Runner and click New self-hosted runner.
  • Run the following command via setting the appropriate token from the settings.
docker run -d --restart always --name github-runner-myrepo \
  -e REPO_URL="https://github.com/username/myrepo" \
  -e RUNNER_NAME="myrepo-runer" \
  -e RUNNER_TOKEN="__REPLACE_ME__" \
  -v /var/run/docker.sock:/var/run/docker.sock \
  myoung34/github-runner:latest

If you would like to set the cache path use the following:

mkdir /tmp/github-runner-myrepo
docker run -d --restart always --name github-runner-myrepo \
  -e REPO_URL="https://github.com/username/myrepo" \
  -e RUNNER_NAME="myrepo-runer" \
  -e RUNNER_TOKEN="__REPLACE_ME__" \
  -e RUNNER_WORKDIR="/tmp/github-runner-myrepo" \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /tmp/github-runner-myrepo:/tmp/github-runner-myrepo \
  myoung34/github-runner:latest