Self-hosting
Run Tukang with Docker Compose, give it a token, and keep it up to date.
git clone https://github.com/zakiego/tukang && cd tukang
printf '%s' "<your token>" > github-token && chmod 600 github-token
TUKANG_REPOS=you/web,you/api docker compose up -d --build
docker compose exec tukang tukang checktukang check prints ok or FAIL for the settings, the Docker socket and each repo. Fix every FAIL before you push a job.
What you need
- A Linux host with Docker, or a Mac with OrbStack or Docker Desktop. The runner is Linux on the host's architecture.
- Disk for the image (1.73 GB), the tool cache volume, and each job's workspace while it runs.
- Memory for your jobs. Each job container is capped at
TUKANG_JOB_MEMORY(4gincompose.yaml), and up toTUKANG_MAX_JOBS(2) run at once.
The GitHub token
Tukang lists workflow runs and creates and deletes runners, so the token needs:
- a fine-grained token with access to the repos, with Actions: read and Administration: read and write, or
- a classic token with the
reposcope.
A token sees only the repos it was given. Put it in the github-token file next to compose.yaml, which Compose mounts as a secret at /run/secrets/github_token. Keep the file out of git (the repo's .gitignore already does).
The Docker socket
Serve mounts /var/run/docker.sock so it can start job containers, and runs as root inside its container to use it. Access to the Docker socket is root on the host. Treat serve's container, its token and its dashboard with that in mind:
- Only attach repos whose jobs you trust. Jobs don't get the socket, but they run on your host.
- Keep fork pull requests off it (see Workflows).
- Don't publish the dashboard without a login in front of it or
TUKANG_PASSWORD.
What compose.yaml sets up
| Thing | Value |
|---|---|
| Service | tukang, built from the repo's Dockerfile, image tukang:latest |
| Port | 127.0.0.1:8080 |
| Volumes | the Docker socket, and tukang_data for state.json |
| Secret | ./github-token at /run/secrets/github_token |
| Healthcheck | tukang health every 30 s |
| Logs | 10 MB a file, 3 files |
| Defaults it passes | TUKANG_LABEL=tukang, TUKANG_MAX_JOBS=2, TUKANG_JOB_MEMORY=4g |
Each job container's logs are capped at 10 MB a file, 2 files. Job containers join serve's Docker network and mount the tukang_toolcache volume, which Docker creates on the first job.
Upgrading
git pull
docker compose up -d --buildRunning jobs keep going while serve restarts. The new serve picks them up, and new jobs start from the new image.
The runner inside the image never updates itself. When GitHub stops accepting its version, jobs fail to register. Rebuild with a newer one:
docker compose build --build-arg RUNNER_VERSION=<version from github.com/actions/runner/releases>
docker compose up -dRemoving it
docker compose down
docker rm -f $(docker ps -aq --filter label=tukang.role=job)
docker volume rm tukang_toolcacheAdd -v to docker compose down to delete the history too. Runners that never got a job are deleted from GitHub when serve removes them. Check the repo's Settings, Actions, Runners for any left behind.