Docs about how to generate config for act runner with docker and setup it with docker-compose (#25256)

In this pull request, the following changes are addressed:

- State user should create `config.yaml` before start container to avoid
errors.
- Provided instructions to deploy runners using docker compose.
This commit is contained in:
Zisu Zhang 2023-06-16 11:46:59 +08:00 committed by GitHub
parent 6db66d8ca4
commit e00f3c7742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 0 deletions

View file

@ -76,6 +76,12 @@ docker pull gitea/act_runner:nightly # for the latest nightly build
./act_runner --config config.yaml [command]
```
您亦可以如下使用 docker 创建配置文件:
```bash
docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-config > config.yaml
```
当使用Docker镜像时可以使用`CONFIG_FILE`环境变量指定配置文件。确保将文件作为卷挂载到容器中:
```bash
@ -169,6 +175,27 @@ docker run \
如前所述如果要在主机上直接运行Job可以将其移除。
需要明确的是,这里的 "主机" 实际上指的是当前运行 Act Runner的容器而不是主机机器本身。
### 使用 Docker compose 运行 Runner
您亦可使用如下的 `docker-compose.yml`:
```yml
version: "3.8"
services:
runner:
image: gitea/act_runner:nightly
environment:
CONFIG_FILE: /config.yaml
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
volumes:
- ./config.yaml:/config.yaml
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock
```
### 当您使用 Docker 镜像启动 Runner如何配置 Cache
如果你不打算在工作流中使用 `actions/cache`,你可以忽略本段。