Running Gitea Actions self-hosted on a cheap N100 mini-PC gets you GitHub-style workflows with no minute cap. You pay for the box and the electricity, and nobody meters your builds.
I'm using Forgejo, the community-run Gitea fork, because I prefer its governance and the workflow syntax is close to identical. The Gitea differences are covered near the end.
The high-level steps:
- Prepare a mini-PC running Docker Compose, with an existing Traefik network.
- Create the Compose stack for Forgejo, the runner and Docker-in-Docker.
- Write the runner config with labels, caching and resource limits.
- Start Forgejo, create an admin user and register the runner.
- Add your secrets and push a first workflow.
- Schedule image pruning and back up the instance.
Is self-hosted CI/CD cheaper than GitHub Actions?
Yes, if you build private repos often enough to exceed the free allowance. GitHub Free includes 2,000 minutes a month for private repos, while standard runners are free for public ones.
A box averaging 10 W uses about 88 kWh a year, or roughly £24 at 27p per kWh. A Beelink N100 with 16 GB of RAM and an NVMe drive is a sensible target because CI hammers disk and memory.
Policy risk matters too. In December 2025 GitHub announced a $0.002 per minute charge for self-hosted runners in private repos, then postponed it after the backlash. Owning the control plane as well as the runner makes that someone else's problem.
What do you need before starting?
You need Docker with the Compose plugin, a DNS record for your Git host, and Traefik attached to an external Docker network. These examples use git.example.com, 192.168.1.50, a network called proxy and a resolver called letsencrypt; swap in your own.
No Traefik yet? Start with the Traefik 3 and Docker Compose setup guide.
Runner: the daemon that polls Forgejo for jobs and launches a container for each one.
Docker-in-Docker (DinD): a separate Docker daemon inside a container, which keeps CI images and containers out of your host's Docker daemon.
Create the Gitea Actions self-hosted Compose stack
Put Forgejo on the Traefik network, and keep the runner and DinD on their own. Create the directories and an explicit secret key first:
mkdir -p ~/ci/forgejo ~/ci/runner
cd ~/ci
echo "FORGEJO_SECRET_KEY=$(openssl rand -hex 32)" > .env
chmod 600 .env
sudo chown -R 1000:1000 forgejo runnerSave this as ~/ci/compose.yml. Check the image tags against current releases before you deploy.
x-hosts: &hosts
- "git.example.com:192.168.1.50"
services:
forgejo:
image: codeberg.org/forgejo/forgejo:15
restart: unless-stopped
environment:
USER_UID: "1000"
USER_GID: "1000"
FORGEJO__server__DOMAIN: git.example.com
FORGEJO__server__ROOT_URL: https://git.example.com/
FORGEJO__server__SSH_PORT: "2222"
FORGEJO__database__DB_TYPE: sqlite3
FORGEJO__security__INSTALL_LOCK: "true"
FORGEJO__security__SECRET_KEY: ${FORGEJO_SECRET_KEY}
FORGEJO__service__DISABLE_REGISTRATION: "true"
volumes:
- ./forgejo:/data
ports:
- "2222:22"
networks: [proxy]
labels:
- traefik.enable=true
- traefik.docker.network=proxy
- traefik.http.routers.forgejo.rule=Host(`git.example.com`)
- traefik.http.routers.forgejo.entrypoints=websecure
- traefik.http.routers.forgejo.tls.certresolver=letsencrypt
- traefik.http.services.forgejo.loadbalancer.server.port=3000
docker-in-docker:
image: docker:28-dind
restart: unless-stopped
privileged: true
command: ["dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false"]
extra_hosts: *hosts
volumes:
- dind-data:/var/lib/docker
networks:
ci:
ipv4_address: 10.89.0.10
runner:
image: data.forgejo.org/forgejo/runner:12
restart: unless-stopped
user: "1000:1000"
command: forgejo-runner daemon --config /data/config.yml
depends_on: [docker-in-docker]
environment:
DOCKER_HOST: tcp://10.89.0.10:2375
extra_hosts: *hosts
volumes:
- ./runner:/data
networks: [ci]
networks:
proxy:
external: true
ci:
ipam:
config:
- subnet: 10.89.0.0/24
volumes:
dind-data:The repeated host mapping is deliberate. The runner, the DinD daemon and the job containers each resolve your Git host separately, so missing one produces the classic "clone works, push fails" evening.
Configure the Forgejo Actions runner and caching
Set labels, concurrency and the cache directory in one config file. Two concurrent jobs is the right ceiling for a four-core N100. Save this as ~/ci/runner/config.yml:
runner:
capacity: 2
timeout: 1h
envs:
DOCKER_HOST: tcp://10.89.0.10:2375
labels:
- "ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-24.04"
- "node:docker://node:24-bookworm"
cache:
enabled: true
dir: /data/cache
container:
network: ""
docker_host: "-"
options: "--add-host=git.example.com:192.168.1.50 --cpus=2 --memory=5g"The runner has a built-in cache server, so actions/cache works without S3. Docker layers persist separately in the dind-data volume. If cache steps time out, check that job containers can reach the runner's address on the ci network.
Pick job images carefully: JavaScript actions such as checkout need Node inside the container. A bare Alpine image fails with an error that rarely points at the real cause.
Register the runner
Start Forgejo alone, generate a token, register, then start everything. The runner daemon needs its registration file, so launching the full stack first just creates a restart loop.
cd ~/ci
docker compose up -d forgejo
# wait for https://git.example.com to load, then:
docker compose exec -u git forgejo forgejo admin user create \
--admin --username ops --email ops@example.com --random-password
TOKEN=$(docker compose exec -T -u git forgejo \
forgejo forgejo-cli actions generate-runner-token)
docker compose run --rm --no-deps runner \
forgejo-runner --config /data/config.yml register --no-interactive \
--instance https://git.example.com \
--token "$TOKEN" --name n100
docker compose up -d
docker compose logs --tail=50 runnerOpen the runners page under site administration. Your N100 should appear as idle.
Add secrets and run a workflow
Add credentials under the repo's Actions secrets, then commit a file to .forgejo/workflows/. Create an access token with package write permission and store it as REGISTRY_TOKEN.
This example tests a Node service and pushes its image to Forgejo's built-in registry. It assumes a lockfile, a test script and a Dockerfile. Save it as .forgejo/workflows/build.yml:
name: build
on:
push:
branches: [main]
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- run: npm ci
- run: npm test
- name: Build and push
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
IMAGE: git.example.com/ops/app:${{ github.sha }}
run: |
echo "$REGISTRY_TOKEN" | docker login git.example.com -u ops --password-stdin
docker build -t "$IMAGE" .
docker push "$IMAGE"Pass secrets through env rather than pasting expressions into shell scripts. Keep .env backed up too, because stored secrets depend on that SECRET_KEY.
How do you stop Traefik breaking large pushes?
Raise the read timeout on Traefik's HTTPS entrypoint. Traefik 3 defaults to 60 seconds, which can cut off slow image layers and artifact uploads.
Add this flag to Traefik's static configuration and recreate the container:
- --entrypoints.websecure.transport.respondingTimeouts.readTimeout=600s
Is a self-hosted Actions runner safe?
It is safe for code you trust, and unsafe for anything else. Jobs can reach an unauthenticated, privileged DinD daemon, so treat every workflow author as having root on this machine.
DinD improves isolation from your normal containers, but it is not a security boundary. Use a dedicated mini-PC, put it on its own VLAN, and never auto-run pull requests from strangers. Removing DOCKER_HOST from the job environment does not help, because the port remains reachable.
Maintain it or the disk will fill
Prune DinD weekly and back up Forgejo nightly. Old image layers are the first thing that will kill this setup. Add this with crontab -e:
0 4 * * 0 cd $HOME/ci && docker compose exec -T docker-in-docker docker -H tcp://127.0.0.1:2375 system prune -af --filter until=168hBack up forgejo/, runner/, compose.yml and .env. Stop Forgejo during file-level backups so SQLite stays consistent, and skip runner/cache. A Hetzner Storage Box works well as an off-site Restic target over SFTP.
Monitor disk usage as well as uptime. The Beszel and Uptime Kuma comparison covers both jobs.
What changes if you use Gitea instead?
The architecture stays the same, but the images, commands and paths change. Use Gitea's own server and runner images, the GITEA__ environment prefix and .gitea/workflows/.
Generate the token with gitea actions generate-runner-token. Don't mix runners: the projects have diverged, so pair each server with its own.
The verdict
Use Forgejo with a dedicated N100 if you mostly build private Linux projects. Stay on GitHub for public repos that rely on outside contributors, or anything needing hosted macOS runners. For everything else, this is an excellent GitHub Actions alternative, and the maintenance amounts to updates, pruning and a backup you have actually tested.
FAQs
Can Forgejo run existing GitHub Actions workflows?
Often, with small edits. Standard steps and many marketplace actions work, but actions that depend on GitHub's API may fail. For artifacts, use Forgejo's forgejo/upload-artifact and forgejo/download-artifact actions instead of the GitHub v4 versions.
Is an Intel N100 fast enough for self-hosted CI?
Yes, for linting, tests, container builds and small to medium projects. It has four cores, so limit concurrency to two jobs. Large native compiles and heavy browser test suites deserve a faster CPU.
How much RAM does a homelab CI mini-PC need?
Buy 16 GB. That leaves room for two jobs capped at 5 GB each alongside Forgejo, Traefik and the operating system. An 8 GB box is better limited to one job.
Should I mount the Docker socket or use Docker-in-Docker?
Use Docker-in-Docker. Mounting the host socket lets jobs see and control every container on the machine. DinD separates CI state from your services, although its privileged container still is not a strong security boundary.
Does the Forgejo runner need an open inbound port?
No. The runner connects out to Forgejo and polls for work, so it can sit behind NAT. Only the Git server needs to be reachable by your users and runners.