前置条件:
https://www.hcjike.com/archives/kdS2GAuo
1、创建专属桥接网络
若已创建,可跳过此步骤。
2、部署服务
2.1、Compose配置
services:
gitea_runner:
image: gitea/act_runner:latest
container_name: gitea_runner
restart: always
networks:
- app_network
volumes:
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock
environment:
- GITEA_INSTANCE_URL=http(s)://gitea.demo.com:88
- GITEA_RUNNER_REGISTRATION_TOKEN=gitea的runner token
- GITEA_RUNNER_NAME=Global
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster
networks:
app_network:
external: true
GITEA_INSTANCE_URL
:填写Gitea最终访问路径;GITEA_RUNNER_REGISTRATION_TOKEN
:
在
后台管理 - Actions - Runners
,获取全局的runner令牌
;
GITEA_RUNNER_NAME
:名称;GITEA_RUNNER_LABELS
:按照官方文档填写;
ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster
填写上述信息,将会识别工作流中定义系统类型为
ubuntu
的任务。
部署并启动服务后,可以在后台管理 - Actions - Runners
查看相关信息。
2.2、Gitea启用ACTIONS_URL相对Gitea地址(修改Gitea配置文件)
配置文件位置
Gitea装载路径:/data/gitea/conf/app.ini
(按照自己映射路径寻找/gitea/conf/app.ini
)
[actions]
ENABLED = true
DEFAULT_ACTIONS_URL = self
查找
actions
配置节点:若存在,则修改为上述配置内容;
若不存在,则可在文件末尾添加上述配置内容。