Patrick de Ruiter e4b8d4e710
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Add Gitea Actions CI/CD pipeline and runner configuration
- Add workflow for building and pushing Docker image to Nexus registry
- Configure semantic versioning from git tags (v1.0.0 -> 1.0.0, latest)
- Add self-hosted runner configuration with Alpine Linux support
- Runner uses docker:27-cli image for Docker-in-Docker builds
2025-12-25 14:14:44 +01:00

83 lines
1.8 KiB
Markdown

# Gitea Actions Runner
This directory contains the configuration for a self-hosted Gitea Actions runner that supports Alpine Linux and Docker builds.
## Setup
### 1. Get a Registration Token
Get a runner registration token from one of these locations in Gitea:
- **Organization runner** (recommended): `https://git.bsdserver.nl/org/wbyc/settings/actions/runners`
- **Repository runner**: `https://git.bsdserver.nl/wbyc/docker-openldap/settings/actions/runners`
- **Instance runner**: Site Administration → Actions → Runners
Click "Create new Runner" to get a token.
### 2. Configure Environment
```bash
cp .env.example .env
# Edit .env and set GITEA_RUNNER_REGISTRATION_TOKEN
```
### 3. Start the Runner
```bash
docker compose up -d
```
### 4. Verify Registration
Check that the runner appears in Gitea under the same location where you got the token.
## Configuration
### Labels
The runner is configured with these labels:
| Label | Image | Use Case |
|-------|-------|----------|
| `self-hosted` | `alpine:3.21` | Default for self-hosted jobs |
| `alpine` | `alpine:3.21` | Explicit Alpine builds |
| `docker` | `docker:27-cli` | Docker CLI with Alpine base |
### Using in Workflows
```yaml
jobs:
build:
runs-on: self-hosted # Uses Alpine
steps:
- uses: actions/checkout@v4
- run: apk add --no-cache docker-cli
- run: docker build -t myimage .
```
## Troubleshooting
### View Logs
```bash
docker compose logs -f
```
### Re-register Runner
If the runner fails to connect, delete and recreate:
```bash
docker compose down -v
docker compose up -d
```
### Docker Socket Permissions
If you see permission errors, ensure the Docker socket is accessible:
```bash
ls -la /var/run/docker.sock
# Should show: srw-rw---- 1 root docker ...
```