Skip to content

Commit e00f3c7

Browse files
authored
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.
1 parent 6db66d8 commit e00f3c7

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

docs/content/doc/usage/actions/act-runner.en-us.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ The default configuration is safe to use without any modification, so you can ju
7676
./act_runner --config config.yaml [command]
7777
```
7878

79+
You could also generate config file with docker:
80+
81+
```bash
82+
docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-config > config.yaml
83+
```
84+
7985
When you are using the docker image, you can specify the configuration file by using the `CONFIG_FILE` environment variable. Make sure that the file is mounted into the container as a volume:
8086

8187
```bash
@@ -172,6 +178,27 @@ It is because the act runner will run jobs in docker containers, so it needs to
172178
As mentioned, you can remove it if you want to run jobs in the host directly.
173179
To be clear, the "host" actually means the container which is running the act runner now, instead of the host machine.
174180

181+
### Set up the runner using docker compose
182+
183+
You could also set up the runner using the following `docker-compose.yml`:
184+
185+
```yml
186+
version: "3.8"
187+
services:
188+
runner:
189+
image: gitea/act_runner:nightly
190+
environment:
191+
CONFIG_FILE: /config.yaml
192+
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
193+
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
194+
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
195+
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
196+
volumes:
197+
- ./config.yaml:/config.yaml
198+
- ./data:/data
199+
- /var/run/docker.sock:/var/run/docker.sock
200+
```
201+
175202
### Configuring cache when starting a Runner using docker image
176203
177204
If you do not intend to use `actions/cache` in workflow, you can ignore this section.

docs/content/doc/usage/actions/act-runner.zh-cn.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ docker pull gitea/act_runner:nightly # for the latest nightly build
7676
./act_runner --config config.yaml [command]
7777
```
7878

79+
您亦可以如下使用 docker 创建配置文件:
80+
81+
```bash
82+
docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-config > config.yaml
83+
```
84+
7985
当使用Docker镜像时,可以使用`CONFIG_FILE`环境变量指定配置文件。确保将文件作为卷挂载到容器中:
8086

8187
```bash
@@ -169,6 +175,27 @@ docker run \
169175
如前所述,如果要在主机上直接运行Job,可以将其移除。
170176
需要明确的是,这里的 "主机" 实际上指的是当前运行 Act Runner的容器,而不是主机机器本身。
171177

178+
### 使用 Docker compose 运行 Runner
179+
180+
您亦可使用如下的 `docker-compose.yml`:
181+
182+
```yml
183+
version: "3.8"
184+
services:
185+
runner:
186+
image: gitea/act_runner:nightly
187+
environment:
188+
CONFIG_FILE: /config.yaml
189+
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
190+
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
191+
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
192+
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
193+
volumes:
194+
- ./config.yaml:/config.yaml
195+
- ./data:/data
196+
- /var/run/docker.sock:/var/run/docker.sock
197+
```
198+
172199
### 当您使用 Docker 镜像启动 Runner,如何配置 Cache
173200
174201
如果你不打算在工作流中使用 `actions/cache`,你可以忽略本段。

0 commit comments

Comments
 (0)