Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Docker Based Custom (Self-Hosted) Github Runner
https://github.com/hasithaishere/github-runner

docker github-runner github-runners gtihub-actions self-hosted self-hosted-runner

Last synced: 17 days ago
JSON representation

Docker Based Custom (Self-Hosted) Github Runner

Awesome Lists containing this project

README

        


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:

- [Git](https://git-scm.com/downloads)
- [Docker](https://docs.docker.com/get-docker/)

Next, clone the repository and follow the steps below.

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

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

```shell
cd github-runner
sh build.sh
```

>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.

```shell
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.

```shell
docker pull hasithaishere/github-runner
```
_**OR**_
```shell
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

```shell
#Run container from image:
docker run -e GH_TOKEN='' -e GH_OWNER='' -e GH_REPOSITORY='' -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