Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,21 @@ To stop the containers:
```bash
docker compose down
```

### Github ARC

This image can also be used with Github Actions Runner Controller (ARC).

To use it, modify the `values.yaml` during the ScaleSet installation:
```yaml
template:
spec:
runtimeClassName: sysbox-runc
hostUsers: false
containers:
- name: runner
image: "ghcr.io/ableytner/docker-github-actions-runner:dev-ubuntu"
imagePullPolicy: Always
command:
- /entrypoint-arc.sh
```
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ services:
TOKEN: ${TOKEN}
# These are in addition to self-hosted,Linux,<arch>
# EXTRA_LABELS: docker,nonroot,example
# You can add additional args that are passed to the runner binary
# RUNNER_ARGS: --ephemeral
deploy:
mode: replicated
replicas: 2
Expand Down
14 changes: 8 additions & 6 deletions linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y curl jq sudo \
&& useradd -m runner \
&& useradd -m -G 0 runner \
&& usermod -aG sudo runner \
&& echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& mkdir /opt/hostedtoolcache \
&& chmod 777 /opt/hostedtoolcache

# install github actions runner
RUN INSTRUCTION_SET="$(arch | sed s/aarch64/arm64/ | sed s/x86_64/x64/)" \
&& mkdir -p /home/runner/actions-runner \
&& curl -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${INSTRUCTION_SET}-${RUNNER_VERSION}.tar.gz -o /home/runner/actions-runner/actions.tar.gz \
&& cd /home/runner/actions-runner \
RUN ARCH="$(arch | sed s/aarch64/arm64/ | sed s/x86_64/x64/)" \
&& mkdir -p /home/runner \
&& curl -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz -o /home/runner/actions.tar.gz \
&& cd /home/runner \
&& tar -xzf actions.tar.gz \
&& rm actions.tar.gz \
&& chown -R runner /home/runner/actions-runner \
&& chown -R runner /home/runner \
&& ./bin/installdependencies.sh

# install simple apt packages
Expand Down Expand Up @@ -85,4 +85,6 @@ COPY --chmod=755 scripts/* /
# switch to the runner user
USER runner

WORKDIR /home/runner

ENTRYPOINT ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions linux/scripts/entrypoint-arc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -o nounset

# [SETUP]

# start docker
echo "Starting docker..."
sudo service docker start > /dev/null
sleep 5
if [[ "$(service docker status)" == *"Docker is running"* ]]; then
echo "Done!"
else
echo "Docker didn't start, status is:"
service docker status
exit 1
fi

# [START]

/home/runner/run.sh
5 changes: 3 additions & 2 deletions linux/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi

echo "Registering runner..."

cd /home/runner/actions-runner
cd /home/runner

if [[ -v REPO ]]; then
REQ_TOKEN_URL=https://api.github.com/repos/${REPO}/actions/runners/registration-token
Expand All @@ -61,7 +61,8 @@ rm token_resp.txt
--name "${RUNNER_NAME:-"runner-ubuntu"}-${HOSTNAME}" \
--unattended \
--disableupdate \
--labels "${EXTRA_LABELS:-}"
--labels "${EXTRA_LABELS:-}" \
"${RUNNER_ARGS:-}"

cleanup() {
echo "Removing runner..."
Expand Down
Loading