Clone
6.4 GiteaRunner(Alpine)
jsc-wiki edited this page 2026-10-14 06:27:29 +00:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

GiteaRunner(Alpine)

第6章 開發與持續整合 · 來源:JSC 知識庫

簡介

在 Alpine 安裝 Gitea Runner 並設定為服務。

步驟

1. 下載 Gitea Runner

wget https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-linux-amd64 -O /usr/local/bin/act_runner

將 act_runner 設定為可執行檔

chmod +x /usr/local/bin/act_runner

2. 註冊 Gitea Runner

設定參數

GITEA_URL='https://gitea.jsc.idv.tw'
REGISTER_TOKEN='<Runner token>'
RUNNER_LABELS='ct-docker'
RUNNER_NAME='ct-docker'
act_runner register --no-interactive --instance $GITEA_URL --token $REGISTER_TOKEN --labels $RUNNER_LABELS --name $RUNNER_NAME

3. 設計 Gitea Runner 服務

nano /etc/init.d/act_runner

服務檔內容

#!/sbin/openrc-run

name="act_runner"
directory="/root"
description="Gitea Actions runner"
command="/usr/local/bin/act_runner"
command_args="daemon"
command_user="root"
command_background="yes"
pidfile="/run/${name}.pid"

depend() {
    need net
}

將服務改為可執行

chmod +x /etc/init.d/act_runner

啟動服務

rc-service act_runner start && rc-service act_runner status && rc-update add act_runner

← 6.3 Gitea Runner(Windows) · 本章目錄 · 全書目錄 · 6.5 Gitlab →