File tree Expand file tree Collapse file tree 6 files changed +112
-0
lines changed
Expand file tree Collapse file tree 6 files changed +112
-0
lines changed Original file line number Diff line number Diff line change 1+ github : rustunit
Original file line number Diff line number Diff line change 1+ name : cd
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ pull_request :
7+
8+ jobs :
9+ build_runner :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : read
13+ packages : write
14+ attestations : write
15+ steps :
16+ - uses : actions/checkout@v4
17+ - name : Log in to the Container registry
18+ uses : docker/login-action@v3
19+ with :
20+ registry : ghcr.io
21+ username : ${{ github.actor }}
22+ password : ${{ secrets.GITHUB_TOKEN }}
23+ - uses : extractions/setup-just@v1
24+ - name : Docker build
25+ run : |
26+ cd runner
27+ just build
28+ - name : Docker Push
29+ run : |
30+ cd runner
31+ just push
Original file line number Diff line number Diff line change 11# github-runner
22Our custom docker image used for self hosted gh runners
3+
4+ It requires you to have setup a github PAT with these scopes:
5+ * ` repo `
6+ * ` admin:org `
7+
8+ This runner is build to be used on an organizational level, you need to provide these two ` env ` vars:
9+
10+ ```
11+ $ORGANIZATION
12+ $ACCESS_TOKEN
13+ ```
Original file line number Diff line number Diff line change 1+ FROM ghcr.io/actions/actions-runner:2.320.0
2+
3+ USER root
4+
5+ # Update and upgrade the system
6+ RUN apt-get update -y && apt-get upgrade -y
7+
8+ # Install necessary packages
9+ RUN apt-get install -y --no-install-recommends \
10+ curl \
11+ wget \
12+ build-essential \
13+ libssl-dev \
14+ libffi-dev \
15+ jq \
16+ sudo \
17+ libasound2-dev \
18+ libudev-dev \
19+ unzip \
20+ pkg-config \
21+ apt-transport-https \
22+ ca-certificates && \
23+ rm -rf /var/lib/apt/lists/*
24+
25+ # Copy the start script and make it executable
26+ COPY start.sh /start.sh
27+ RUN chmod +x /start.sh
28+
29+ USER runner
30+
31+ # Define the entrypoint
32+ ENTRYPOINT ["/start.sh"]
Original file line number Diff line number Diff line change 1+
2+ IMAGE_NAME := " ghcr.io/rustunit/github-runner"
3+ IMAGE_TAG := " 0.1.0"
4+
5+ build :
6+ docker build -t {{ IMAGE_NAME}} :latest .
7+ docker build -t {{ IMAGE_NAME}} :{{ IMAGE_TAG}} .
8+
9+ push :
10+ docker push {{ IMAGE_NAME}}
11+ docker push {{ IMAGE_NAME}} :{{ IMAGE_TAG}}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ ORGANIZATION=$ORGANIZATION
4+ ACCESS_TOKEN=$ACCESS_TOKEN
5+
6+ echo " Get Reg-Token for ${ORGANIZATION} and '${ORGANIZATION} '"
7+
8+ REG_TOKEN=$( curl -sX POST -H " Authorization: token ${ACCESS_TOKEN} " https://api.github.com/orgs/${ORGANIZATION} /actions/runners/registration-token | jq .token --raw-output)
9+
10+ cd /home/docker/actions-runner
11+
12+ echo " Config..."
13+
14+ ./config.sh --url https://github.com/${ORGANIZATION} --token ${REG_TOKEN}
15+
16+ cleanup () {
17+ echo " Removing runner..."
18+ ./config.sh remove --unattended --token ${REG_TOKEN}
19+ }
20+
21+ trap ' cleanup; exit 130' INT
22+ trap ' cleanup; exit 143' TERM
23+
24+ echo " Run..."
25+
26+ ./run.sh & wait $!
You can’t perform that action at this time.
0 commit comments