├── entrypoint.sh ├── scripts ├── docker-build-arm64.sh └── docker-buildx-push.sh ├── README.md ├── NOTES.md └── Dockerfile /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "RUN_DOCKERD" = "true" ]; then 4 | sudo /usr/bin/dockerd & 5 | fi 6 | 7 | exec "$@" 8 | -------------------------------------------------------------------------------- /scripts/docker-build-arm64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | if [ -z "$RUNNER_IMAGE" ]; then 4 | echo "RUNNER_IMAGE is not set. Please set it to the name of the image to be built and pushed." 5 | echo "Do also make sure that you have logged in to the registry. Head to https://hub.docker.com/settings/security?generateToken=true to generate a token for docker-login." 6 | exit 1 7 | fi 8 | 9 | set -evx 10 | 11 | docker build --platform linux/arm64,linux/amd64 -t ${RUNNER_IMAGE} \ 12 | --push -f Dockerfile . 13 | -------------------------------------------------------------------------------- /scripts/docker-buildx-push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | if [ -z "$RUNNER_IMAGE" ]; then 4 | echo "RUNNER_IMAGE is not set. Please set it to the name of the image to be built and pushed." 5 | echo "Do also make sure that you have logged in to the registry. Head to https://hub.docker.com/settings/security?generateToken=true to generate a token for docker-login." 6 | exit 1 7 | fi 8 | 9 | set -evx 10 | 11 | # We explicitly say `buildx build` because 12 | # docker buildx --platform or docker build --platform doesn't work as we might have expected 13 | 14 | docker buildx build --platform linux/arm64,linux/amd64 -t ${RUNNER_IMAGE} \ 15 | --push -f Dockerfile . 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # runner-images 2 | 3 | This is an ongoing effort to provide a set of Docker images for GitHub Actions self-hosted runners. 4 | 5 | It's maintained and driven by the community so that 6 | we can try to go beyond the bandwidth of GitHub Actions team. The Actions team focus more on the core ARC and Actions. We, the community, focus more on our own use-cases and runner images needed for those. 7 | 8 | This project was inspired by and started as a fork of [quipper/actions-runner](https://github.com/quipper/actions-runner). Much appreciation to the folks Quipper for sharing their awesome work! 9 | 10 | ## Features 11 | 12 | - We fork and occasionally rebase onto [actions/runner official Dockerfile](https://github.com/actions/runner/blob/main/images/Dockerfile) for both compatibility and more features. 13 | - We DON'T provide `latest` only because we'd love to NOT break your production environments when we introduce backward-incompatible changes to the images. 14 | - Single `Dockerfile` for multiple use-cases and runner modes. 15 | 16 | ## Usage 17 | 18 | - You can specify "RUN_DOCKERD=true" to start a dind daemon within the runner container. 19 | -------------------------------------------------------------------------------- /NOTES.md: -------------------------------------------------------------------------------- 1 | # Implementation notes 2 | 3 | ## setup-ruby 4 | 5 | It turns out `setup-ruby` is not supposed to install Ruby on self-hosted runners. 6 | 7 | When we tried bundling the tool cache for a Ruby version like: 8 | 9 | ``` 10 | RUN export PATH=$PATH:/home/runner/externals/node20/bin ; export NODE_PATH=/home/runner/externals/node20/lib/node_modules ; \ 11 | npm install -g https://github.com/ruby/setup-ruby && env "INPUT_RUBY-VERSION=3.2.2" node < /etc/sudoers \ 47 | && echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers 48 | 49 | WORKDIR /home/runner 50 | RUN export RUNNER_ARCH=${TARGETARCH} \ 51 | && if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \ 52 | && curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \ 53 | && tar xzf ./runner.tar.gz \ 54 | && rm runner.tar.gz 55 | 56 | RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \ 57 | && unzip ./runner-container-hooks.zip -d ./k8s \ 58 | && rm runner-container-hooks.zip 59 | 60 | RUN export RUNNER_ARCH=${TARGETARCH} \ 61 | && if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \ 62 | && if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \ 63 | && curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \ 64 | && tar zxvf docker.tgz \ 65 | && rm -rf docker.tgz \ 66 | && install -o root -g root -m 755 docker/* /usr/bin/ \ 67 | && rm -rf docker 68 | 69 | # some setup actions store cache into /opt/hostedtoolcache 70 | ENV RUNNER_TOOL_CACHE /opt/hostedtoolcache 71 | 72 | RUN mkdir /opt/hostedtoolcache \ 73 | && chown runner:docker /opt/hostedtoolcache 74 | 75 | # We pre-install nodejs to reduce time of setup-node and improve its reliability. 76 | ENV NODE_VERSION 18.18.2 77 | 78 | RUN if [ "${TARGETARCH}" = "amd64" ]; then export NODE_ARCH=x64 ; else export NODE_ARCH=${TARGETARCH} ; fi; \ 79 | mkdir -p /opt/hostedtoolcache/node/${NODE_VERSION}/${NODE_ARCH} && \ 80 | curl -s -L https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz \ 81 | | tar xvzf - --strip-components=1 -C /opt/hostedtoolcache/node/${NODE_VERSION}/${NODE_ARCH} \ 82 | && touch /opt/hostedtoolcache/node/${NODE_VERSION}/${NODE_ARCH}.complete \ 83 | && chown -R runner:docker /opt/hostedtoolcache/node && \ 84 | ${RUNNER_TOOL_CACHE}/node/${NODE_VERSION}/${NODE_ARCH}/bin/node --version 85 | 86 | RUN export PATH=$PATH:/home/runner/externals/node20/bin ; export NODE_PATH=/home/runner/externals/node20/lib/node_modules ; \ 87 | npm install -g @actions/tool-cache && node <