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

https://github.com/aldhinn/gh-self

gh-self is a set of open source docker images for running GitHub Actions workflows.
https://github.com/aldhinn/gh-self

docker docker-container docker-image github-actions github-runners

Last synced: about 1 year ago
JSON representation

gh-self is a set of open source docker images for running GitHub Actions workflows.

Awesome Lists containing this project

README

          


GitHub Logo

gh-self

[![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](./LICENSE)

[![CI](https://github.com/aldhinn/gh-self/actions/workflows/ci.yaml/badge.svg)](https://github.com/aldhinn/gh-self/actions/workflows/ci.yaml)

**gh-self** is a set of open source docker images for running ```GitHub Actions``` workflows.

## 🚀 Usage

This image provides a self-hosted runner for GitHub Actions. When setting up and running the container, you need to map local files containing your GitHub repository URL and runner registration token to the appropriate secrets within the container.

### 📝 Preparations

Before using this self-hosted runner, make sure you have:

1. A **GitHub repository** for which you will be running workflows.
2. A **GitHub runner registration token** (provided when setting up a new self-hosted runner for your repository).

You can get this token by following these steps:
- Go to **Settings** > **Actions** > **Runners** in your GitHub repository.
- Click **New self-hosted runner** and under the instructions to **Configure**, you will see the token value written in such manner.
```
./config.sh --url https://github.com/your-org/your-repo --token
```
- Keep this token value safe, as it will be needed to authenticate the runner.

### ⚙️ Steps to Run the Self-Hosted Runner

1. **Prepare the required files:**
- Create a file `GITHUB_REPO_FILE` containing the URL to your GitHub repository (e.g., `https://github.com/your-org/your-repo`).
- Create a file `TOKEN_VALUE_FILE` containing the GitHub runner registration token stored [earlier](#-preparations).

2. **Run the Docker container:**

When running the Docker container, make sure to map the local files (`GITHUB_REPO_FILE` and `TOKEN_VALUE_FILE`) to the correct paths inside the container where GitHub Actions will look for them. Use the following command:

```bash
docker run -d --name github-actions-self-hosed-runner \
-v /local/path/to/GITHUB_REPO_FILE:/run/secrets/GITHUB_REPO_FILE \
-v /local/path/to/TOKEN_VALUE_FILE:/run/secrets/TOKEN_VALUE_FILE \
aldhinn/gh-self:amd64-debian
```
(The example above used the tag ```amd64-debian``` but choose the ones you'd like from [here](https://hub.docker.com/r/aldhinn/gh-self/tags).)

Optionally, you can also specify the name of the runner by storing it to `/run/secrets/GITHUB_RUNNER_NAME_FILE`:
```bash
docker run -d --name github-actions-self-hosed-runner \
-v /local/path/to/GITHUB_REPO_FILE:/run/secrets/GITHUB_REPO_FILE \
-v /local/path/to/TOKEN_VALUE_FILE:/run/secrets/TOKEN_VALUE_FILE \
-v /local/path/to/GITHUB_RUNNER_NAME_FILE:/run/secrets/GITHUB_RUNNER_NAME_FILE \
aldhinn/gh-self:amd64-debian
```