-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker image for Github Actions runner
This change adds configuration for a Docker image to be used as Github Actions runner.
- Loading branch information
1 parent
0ffeef0
commit 7d28f8c
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FROM debian:bullseye | ||
|
||
ARG GITHUB_RUNNER_VERSION="2.301.1" | ||
|
||
ENV GITHUB_PAT "" | ||
ENV GITHUB_OWNER "fabianishere" | ||
ENV GITHUB_REPOSITORY "pve-edge-kernel" | ||
ENV RUNNER_WORKDIR "_work" | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
curl \ | ||
sudo \ | ||
git \ | ||
jq \ | ||
devscripts \ | ||
debhelper \ | ||
equivs \ | ||
asciidoc \ | ||
bc \ | ||
bison \ | ||
cpio \ | ||
dwarves \ | ||
flex \ | ||
kmod \ | ||
libdw-dev \ | ||
libelf-dev \ | ||
libiberty-dev \ | ||
libnuma-dev \ | ||
libslang2-dev \ | ||
libssl-dev \ | ||
lz4 \ | ||
quilt \ | ||
rsync \ | ||
xmlto \ | ||
zlib1g-dev \ | ||
zstd \ | ||
python3-dev \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& useradd -m github \ | ||
&& usermod -aG sudo github \ | ||
&& echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
USER github | ||
WORKDIR /home/github | ||
|
||
RUN curl -Ls https://github.com/actions/runner/releases/download/v${GITHUB_RUNNER_VERSION}/actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz | tar xz | ||
|
||
COPY --chown=github:github entrypoint.sh ./entrypoint.sh | ||
RUN sudo chmod u+x ./entrypoint.sh | ||
|
||
ENTRYPOINT ["/home/github/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
registration_url="https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPOSITORY}/actions/runners/registration-token" | ||
echo "Requesting registration URL at '${registration_url}'" | ||
|
||
payload=$(curl -sX POST -H "Authorization: token ${GITHUB_PAT}" ${registration_url}) | ||
export RUNNER_TOKEN=$(echo $payload | jq .token --raw-output) | ||
|
||
./config.sh \ | ||
--name $(hostname) \ | ||
--token ${RUNNER_TOKEN} \ | ||
--url https://github.com/${GITHUB_OWNER}/${GITHUB_REPOSITORY} \ | ||
--work ${RUNNER_WORKDIR} \ | ||
--unattended \ | ||
--replace \ | ||
--label bullseye | ||
|
||
remove() { | ||
./config.sh remove --token "${RUNNER_TOKEN}" | ||
} | ||
|
||
trap 'remove; exit 130' INT | ||
trap 'remove; exit 143' TERM | ||
|
||
./run.sh "$*" & | ||
|
||
wait $! |