62 lines
1.8 KiB
Markdown
62 lines
1.8 KiB
Markdown
## Forgejo-Runner
|
|
|
|
This is a minor modifyed version of `ghcr.io/catthehacker/ubuntu:act-22.04`. It houses the forgejo-runner binary and executes it on startup with "daemon".
|
|
|
|
This runner needs dind to execute docker commands in a secured environment.
|
|
|
|
```yaml
|
|
services:
|
|
docker-in-docker:
|
|
image: docker:dind
|
|
container_name: "docker_dind"
|
|
hostname: docker
|
|
privileged: "true"
|
|
command: ["dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false"]
|
|
restart: "unless-stopped"
|
|
|
|
pika-runner:
|
|
image: pika-runner:latest
|
|
depends_on:
|
|
- docker-in-docker
|
|
environment:
|
|
DOCKER_HOST: "tcp://docker:2375"
|
|
volumes:
|
|
- ./config:/home/runner
|
|
```
|
|
|
|
Now run `docker compose run --rm pika-runner forgejo-runner register`
|
|
|
|
You should be asked to input your forgejo url like `https://git.k4li.de/`, your runner token, which you aquire in admin mode when adding runners. Then it askes for the label to use. In my case, this label works perfectly fine for me `self-hosted:host://-self-hosted`
|
|
|
|
After this, you can successfully build docker images, and use almost every github actions workflow you like. INSIDE DOCKER!!
|
|
|
|
example workflow that works:
|
|
|
|
> [!NOTE]
|
|
> This is my workflow to push my modifyed caddy container to my registry
|
|
|
|
```yaml workflow.yml
|
|
name: Build and Push to Forgejo Registry
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
checkout:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Forgejo Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.k4li.de
|
|
username: ${{ vars.FORGEJO_USERNAME }}
|
|
password: ${{ vars.FORGEJO_PASSWORD }}
|
|
- name: Build n Push
|
|
run: |
|
|
docker build -t git.k4li.de/docker/caddy:latest .
|
|
docker push git.k4li.de/docker/caddy:latest
|
|
```
|