Project Icon

docker-gitea-act-runner

基于Debian的Gitea CI/CD运行器Docker镜像

docker-gitea-act-runner项目基于Debian构建Docker镜像,内置Gitea的act_runner。提供Docker-out-of-Docker、Docker-in-Docker和无根Docker-in-Docker三种模式,适应不同CI/CD场景。支持自动注册、并发作业控制和缓存服务器等配置,为Gitea用户打造高效、安全的工作流环境。

vegardit/gitea-act-runner

Build Status License Docker Pulls Docker Stars Contributor Covenant

  1. What is it?
  2. Usage
  3. License

What is it?

debian:stable-slim based Docker image containing Gitea's act_runner

Why not using Alpine Linux?

Usage

The docker image comes in three flavors:

  • vegardit/gitea-act-runner:latest: only contains the Gitea act_runner and executes workflows in containers of the docker engine running act_runner itself (DooD / Docker-out-of-Docker approach)
  • vegardit/gitea-act-runner:dind-latest: executes workflows using an embedded docker engine (DinD / Docker-in-Docker approach) providing better process isolation
  • vegardit/gitea-act-runner:dind-rootless-latest: executes workflows using an embedded docker engine (DinD / Docker-in-Docker approach) running the docker daemon as a non-root user (Rootless mode)

Docker Run

Running from the command line:

  • Docker-out-of-Docker approach

      docker run \
        -e GITEA_INSTANCE_URL=https://gitea.example.com \
        -e GITEA_RUNNER_REGISTRATION_TOKEN=<INSERT_TOKEN_HERE> \
        --name gitea_act_runner \
        -v /var/run/docker.sock:/var/run/docker.sock:rw \
        vegardit/gitea-act-runner:latest
    
  • Docker-in-Docker approach

      docker run \
        -e GITEA_INSTANCE_URL=https://gitea.example.com \
        -e GITEA_RUNNER_REGISTRATION_TOKEN=<INSERT_TOKEN_HERE> \
        --name gitea_act_runner \
        --privileged
        vegardit/gitea-act-runner:dind-latest
    
  • Docker-in-Docker approach with Docker daemon running as a non-root user (Rootless mode)

      docker run \
        -e GITEA_INSTANCE_URL=https://gitea.example.com \
        -e GITEA_RUNNER_REGISTRATION_TOKEN=<INSERT_TOKEN_HERE> \
        --name gitea_act_runner \
        --privileged
        vegardit/gitea-act-runner:dind-rootless-latest
    

Docker Compose

Example docker-compose.yml:

  • Docker-out-of-Docker approach

    # https://docs.docker.com/compose/compose-file/
    
    services:
    
      gitea_act_runner:
        image: vegardit/gitea-act-runner:latest
        #image: ghcr.io/vegardit/gitea-act-runner:latest
        restart: always
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock:rw
          - /my/path/to/data/dir:/data:rw # the config file is located at /data/.runner and needs to survive container restarts
        environment:
          TZ: "Europe/Berlin"
          # config parameters for initial runner registration:
          GITEA_INSTANCE_URL: 'https://gitea.example.com' # required
          GITEA_RUNNER_REGISTRATION_TOKEN_FILE: 'path/to/file' # one-time registration token, only required on first container start
          # or: GITEA_RUNNER_REGISTRATION_TOKEN: '<INSERT_TOKEN_HERE>'
    
  • Docker-in-Docker approach

    # https://docs.docker.com/compose/compose-file/
    
    services:
    
      gitea_act_runner:
        image: vegardit/gitea-act-runner:dind-latest
        #image: ghcr.io/vegarditgitea-act-runner:dind-latest
        privileged: true
        restart: always
        volumes:
          - /my/path/to/data/dir:/data:rw # the config file is located at /data/.runner and needs to survive container restarts
        environment:
          TZ: "Europe/Berlin"
          # config parameters for initial runner registration:
          GITEA_INSTANCE_URL: 'https://gitea.example.com' # required
          GITEA_RUNNER_REGISTRATION_TOKEN_FILE: 'path/to/file' # one-time registration token, only required on first container start
          # or: GITEA_RUNNER_REGISTRATION_TOKEN: '<INSERT_TOKEN_HERE>'
    

Additional environment variables

The following environment variables can be specified to further configure the service.

Runner registration:

NameDefault ValueDescription
GITEA_INSTANCE_INSECUREfalseIt true don't verify the TLS certificate of the Gitea instance
GITEA_RUNNER_NAME<empty>If not specified the container's hostname is used
GITEA_RUNNER_LABELS<empty>Comma-separated list of labels in the format of label[:schema[:args]]. If not specified the following labels are used ubuntu-latest:docker://catthehacker/ubuntu:act-22.04,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,ubuntu-20.04:docker://catthehacker/ubuntu:act-20.04
GITEA_RUNNER_REGISTRATION_FILE/data/.runnerThe JSON file that holds the result from the runner registration with the Gitea instance
GITEA_RUNNER_REGISTRATION_TIMEOUT30In case of failure, registration is retried until this timeout in seconds is reached
GITEA_RUNNER_REGISTRATION_RETRY_INTERVAL5Wait period in seconds between registration retries

Runner runtime config:

NameDefault ValueDescription
GITEA_RUNNER_CONFIG_TEMPLATE_FILE/opt/config.template.yamlTemplate to derive the effective config file from, see image/config.template.yaml
GITEA_RUNNER_UID1000The UID of the Gitea runner process
GITEA_RUNNER_GID1000The GID of the Gitea runner process
GITEA_RUNNER_LOG_EFFECTIVE_CONFIGfalseIf set to true logs the effective YAML configuration to stdout during startup.

Runner config template variables

The following environment variables are referenced in the /opt/config.template.yaml file.

NameDefault ValueDescription
GITEA_RUNNER_LOG_LEVELinfoThe level of logging, can be trace, debug, info, warn, error, fatal
GITEA_RUNNER_ENV_FILE/data/.envExtra environment variables to run jobs from a file
GITEA_RUNNER_FETCH_TIMEOUT5sThe timeout for fetching the job from the Gitea instance
GITEA_RUNNER_FETCH_INTERVAL2sThe interval for fetching the job from the Gitea instance
GITEA_RUNNER_MAX_PARALLEL_JOBS1Maximum number of concurrently executed jobs
GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST<empty>If empty, the available docker host is located automatically. If set to -, the available docker host is located automatically, but the docker host won't be mounted to the job containers. If it's any other value, the specified docker host will be used.
GITEA_RUNNER_JOB_CONTAINER_NETWORKbridgeDocker network to use with job containers. Can be bridge, host, none, or the name of a custom network
GITEA_RUNNER_JOB_CONTAINER_PRIVILEGEDfalseWhether to run jobs in containers with privileged mode which is required for Docker-in-Docker aka dind
GITEA_RUNNER_JOB_CONTAINER_OPTIONS<empty>Additional container launch options (eg, --add-host=my.gitea.url:host-gateway)
GITEA_RUNNER_JOB_CONTAINER_WORKDIR_PARENT/workspaceThe parent directory of a job's working directory.
GITEA_RUNNER_JOB_CONTAINER_FORCE_PULLfalsePull docker images even if already present
GITEA_RUNNER_JOB_TIMEOUT3hThe maximum time a job can run before it is cancelled
GITEA_RUNNER_ENV_VAR_N_NAME<empty>Name of the N-th extra environment variable to be passed to Job containers, e.g. GITEA_RUNNER_ENV_VAR_1_NAME=MY_AUTH_TOKEN
GITEA_RUNNER_ENV_VAR_N_VALUE<empty>Value of the N-th extra environment variable to be passed to Job containers, e.g. GITEA_RUNNER_ENV_VAR_1_VALUE=SGVsbG8gbXkgZnJpZW5kIQ==
GITEA_RUNNER_VALID_VOLUME_N<empty>Volumes (including bind mounts) that are allowed to be mounted into job containers. Glob syntax is supported, e.g. GITEA_RUNNER_VALID_VOLUME_1=/src/*.json
GITEA_RUNNER_HOST_WORKDIR_PARENT/data/cache/actionsThe parent directory of a job's working directory. (Path to cache cloned actions)

Embedded cache server:

NameDefault ValueDescription
ACT_CACHE_SERVER_ENABLEDtrueEnable the use of an embedded or external cache server with actions/cache in jobs
ACT_CACHE_SERVER_EXTERNAL_URL<empty>URL to an external cache server. If specified, act_runner will use this URL as the ACTIONS_CACHE_URL instead of starting an embedded server. The URL should end with "/".
ACT_CACHE_SERVER_DIR/data/cache/serverThe directory to store the cache data
ACT_CACHE_SERVER_HOST<empty>The IP address or hostname via which the job containers can reach the cache server. Leave empty for automatic detection
ACT_CACHE_SERVER_PORT0The TCP port of the cache server. 0 means to use a random, available port

License

All files in this repository are released under the Apache License 2.0.

Individual files contain the following tag instead of the full license text:

SPDX-License-Identifier: Apache-2.0

This enables machine processing of license information based on the SPDX License Identifiers that are available here: https://spdx.org/licenses/.

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号