Github self-hosted runner Dockerfile and Kubernetes configuration

This repository contains a Dockerfile that builds a Docker image suitable for running a self-hosted GitHub runner. A Kubernetes Deployment, and docker-compose, files are included to use like a template to deploy your actions runners.

Building the container

docker build -t github-runner .

Features

  • Repository runners
  • Organizational runners (only with personal access tokens)
  • Labels
  • Graceful shutdown

Examples

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] \
     quay.io/alayacare/github-action-runner

Create an organization-wide runner.

docker run --name github-runner \
    -e GITHUB_OWNER=username-or-organization \
    -e GITHUB_PAT=[PAT] \
    quay.io/alayacare/github-action-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 \
    quay.io/alayacare/github-action-runner