I’ve been happily using Woodpecker CI to get CI for my repositories on Codeberg. Codeberg is a non-profit community-driven git repository hosting platform, so they can’t provide free CI to everyone.
Since I run lots of stuff on small arm boards (for example this website), I need my CI jobs to create arm executables. The easiest way to get that done is to just compile on arm devices, so I was happy to see that Hetzner is now offering arm nodes in their cloud offering.
To make that as cheap as possible, the CI should ideally create a VM before running its job, and remove it again afterwards. Unfortunately Woodpecker does not seem to support that out of the box at this point.
My solution to that was to build a docker proxy, that creates VMs using docker-machine, and then proxies the incoming requests to the remote VM. That works really well now, so maybe you will find it useful.
Setting that up is reasonably simple:
- Install docker-machine. I recommend using the fork by GitLab
- Install the backend for your cloud provider. For Hetzner I use this one
- Grab a binary release of docker-proxy (if you need arm executables), or compile it yourself.
- Create a systemd unit to start the service on boot in
/etc/systemd/system/docker.proxy.service. This particular one just runs it on the
woodpecker-agentuser that you may already have if you use Woodpecker CI.
Description=Docker CI proxy
- Fill in
/etc/docker-proxy/config.tomlThis example works for Hetzner, but everything that has a docker-machine provider should work. You just need to supply the arguments for the correct backend.
- Finally, make
woodpecker-agentuse the new docker proxy, by setting
DOCKER_HOST=http://localhost:8000in its environment.
I hope this may be useful for you as well :)