1、创建专属桥接网络 {#1%E3%80%81%E5%88%9B%E5%BB%BA%E4%B8%93%E5%B1%9E%E6%A1%A5%E6%8E%A5%E7%BD%91%E7%BB%9C}
若已创建,可跳过此步骤。 https://www.hcjike.com/archives/tMUqkbKb
2、部署服务 {#2%E3%80%81%E9%83%A8%E7%BD%B2%E6%9C%8D%E5%8A%A1}
2.1、Compose配置 {#2.1%E3%80%81compose%E9%85%8D%E7%BD%AE}
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
查看相关信息。
https://docs.gitea.com/zh-cn/usage/actions/act-runner
2.2、Gitea启用ACTIONS_URL相对Gitea地址(修改Gitea配置文件) {#2.2%E3%80%81gitea%E5%90%AF%E7%94%A8actions_url%E7%9B%B8%E5%AF%B9gitea%E5%9C%B0%E5%9D%80%EF%BC%88%E4%BF%AE%E6%94%B9gitea%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%EF%BC%89}
配置文件位置Gitea装载路径:/data/gitea/conf/app.ini
(按照自己映射路径寻找/gitea/conf/app.ini
)
[actions]
ENABLED = true
DEFAULT_ACTIONS_URL = self
-
查找
actions
配置节点:-
若存在,则修改为上述配置内容;
-
若不存在,则可在文件末尾添加上述配置内容。
-