There are two main files:
- Dockerfile, to build an ubuntu runner
- start.sh, to config image and run Github's script
This image downloads github's official runner tar file from github, also installs Docker-in-docker(we need to install docker daemon to run docker build step in github workflow) and then runs start.sh
this script first gets repository's url and token provided at repo/setting/actions/runners/linux as variables then run the ./run.sh there's also a function for every time image stopped or removed automatically delete the runner.
first install docker on vm sudo apt update && apt install docker
copy this two files and just change runner's name in start.sh
build image withdocker build -t <image_name:tag> .
then run image with docker run -e GH_REPOSITORY="github repository url" -e GH_TOKEN="token for runner" -d <image_name:tag>