Skip to content

hasithaishere/github-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Runner
GitHub Runner

GitHub Runner

Generally, Github provides free 2000 build minutes in an every month. You can use these build minutes for your personal or any other business purposes. However, sometimes that isn't enough. You might need more build minutes, which is where we come in.

In this project, we build a general purpose GitHub custom runner using Docker. So you can use these docker image to run your wn custom runner in any of your cloud provider or locally without any complexity.

Steps for building container locally

Before following this, make sure you have the prerequisites installed/fulfilled:

Next, clone the repository and follow the steps below.

git clone https://github.com/hasithaishere/github-runner

Then you can go the project root directory and execute build command

cd github-runner
sh build.sh <Docker Hub User Name> <Docker Hub User Password> <OS Name> <OS Version>

If you only want to run this in locally, so please ignore Docker Hub User Name and Docker Hub User Password arguments.

In this version this build script only support ubuntu based docker base images, os OS Name variable should be ubuntu and OS Vesrion need to be basic ubuntu version ex- 20.04 or 22.04

This you can run following docker command and see the build images in locally.

docker images

Pull image form Docker Hub

However if you don't want to build the container locally you can directly pull the image from Docker Hub using following command.

docker pull hasithaishere/github-runner

OR

docker pull hasithaishere/github-runner:tag

Connect Docker Runner with GitHub

Initially you have to generate custom access token for connect your self-hosted runner to GitHub account.

How to generate access token

Please follow these steps to generate custo access token.

  • Click on your profile icon and click on the settings in the dropdown menu.

GitHub Runner


  • Then go to Developer Settings and Click on the Personal Access Token.

GitHub Runner


  • Click on the Generate New Token button.

GitHub Runner


  • Then select following permissions from the list and generate the token.

GitHub Runner


  • Please save your token in safe place before close the window. Because this token you can retrieve one time only.

Please execute following command to bind the local/ cloud based runner to GitHub.

Connect Runner With GitHub Account

#Run container from image:
docker run -e GH_TOKEN='<Your GitHub Token>' -e GH_OWNER='<Organization name/ your user name>' -e GH_REPOSITORY='<Repository Name>' -d hasithaishere/github-runner

If container has been successfully started, you can see the runner in the running container list.

GitHub Runner

And also you can see the container in GitHub Action page's runners list.

GitHub Runner