This is the code that was used to create the self hosted githubrunner
Note Added unzip and nodejs to build on mac, this ay not be necessary when building on Amazon Linux 2
This repository contains a Dockerfile that builds a Docker image suitable for running a self-hosted GitHub runner. A Kubernetes Deployment file is also included that you can use as an example on how to deploy this container to a Kubernetes cluster.
You can build this image yourself, or use the Docker image from the Docker Hub.
docker build -t github-runner .
- Repository runners
- Organizational runners
- Labels
- Graceful shutdown
- Support for installing additional debian packages
- Auto-update after the release of a new version
Register a runner to a repository.
docker run --name github-runner \
-e GITHUB_OWNER=username-or-organization \
-e GITHUB_REPOSITORY=my-repository \
-e GITHUB_PAT=[PAT] \
sanderknape/github-runner
Register a runner with github token.
docker run --name github-runner \
-e GITHUB_OWNER=username-or-organization \
-e GITHUB_REPOSITORY=my-repository \
-e GITHUB_TOKEN=[github.token] \
sanderknape/github-runner
Create an organization-wide runner.
docker run --name github-runner \
-e GITHUB_OWNER=username-or-organization \
-e GITHUB_PAT=[PAT] \
sanderknape/github-runner
Set labels on the runner.
docker run --name github-runner \
-e GITHUB_OWNER=username-or-organization \
-e GITHUB_REPOSITORY=my-repository \
-e GITHUB_PAT=[PAT] \
-e RUNNER_LABELS=comma,separated,labels \
sanderknape/github-runner
Install additional tools on the runner.
docker run --name github-runner \
-e GITHUB_OWNER=username-or-organization \
-e GITHUB_REPOSITORY=my-repository \
-e GITHUB_PAT=[PAT] \
-e ADDITIONAL_PACKAGES=firefox-esr,chromium \
sanderknape/github-runner