Actions Runner dockerfile
This repo contains the Dockerfile for building images that can run self-hosted github runners. A helper script is provided for use on the deidcated server that launches the container and registers the runner with the specified development repo.
- The development repository is hosted on github.com.
- The github runner (or "action runner") is self-hosted on a dedicated server.
- Github runners can be registered with development repositories in a many-to-many relationship.
Rebuild this dockerfile
-
Clone the repo to your linux workstation:
-
Build the dockerfile using your registry settings:
BUILDKIT=1 docker build -t <github_account_url>/actions_runner:ubuntu2204 .
-
push to your registry:
docker push -t <github_account_url>/actions_runner:ubuntu2204 .
Note, you must setup a personal access token to push/pull this with the github docker registry used in the commands above.
Using the docker image on a server
You will need to install docker.io
and grant permissions to the daemon:
sudo chmod 664 /var/run/docker.sock
-
Upload the launch.sh script to the server
-
Modify the registry URL in the launch.sh script to match your own docker registry
-
Run the script using the following arguments:
NAME
:- The chosen name for the container
URL
:- The URL of the github repo
TOKEN
:- The secret token of the github repo (see
settings > Actions > Runners > Linux > Configure
). - Note: these tokens can be viewed using the
docker inspect
command but the tokens expire quickly (after a couple of minutes).
- The secret token of the github repo (see
-
Exit the container (without killing it) by pressing Ctrl-P and then Ctrl-Q.
Note: to kill the container use docker stop <id>
and docker rm <id>
as usual. DOn't forget to the remove the runner from the github.com settings page for the repository.