-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b7549f
commit 513d4f8
Showing
3 changed files
with
82 additions
and
1 deletion.
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
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,63 @@ | ||
# GitHub Runner to build container images and update Jupyter Book | ||
FROM quay.io/podman/stable:latest | ||
|
||
ARG RUNNER_VERSION="2.317.0" | ||
ARG DEBIAN_FRONTEND=nointeractive | ||
ARG REPO=default | ||
ARG TOKEN=secretinformation | ||
|
||
# Provide the Repo and token at run time | ||
ENV TOKEN=${TOKEN} \ | ||
REPO=${REPO} | ||
|
||
# Install OS packages required to run the jobs required | ||
RUN dnf -y update; yum -y install jq \ | ||
git \ | ||
python \ | ||
python-pip \ | ||
svn \ | ||
cpp \ | ||
make \ | ||
autoconf \ | ||
automake \ | ||
patch \ | ||
cmake \ | ||
wget \ | ||
mlocate \ | ||
rpm-build \ | ||
gcc-c++ \ | ||
uuid-devel \ | ||
pkgconfig \ | ||
libtool \ | ||
python-devel \ | ||
openpgm \ | ||
zeromq-devel && \ | ||
dnf -y install 'dnf-command(config-manager)' && \ | ||
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo && \ | ||
dnf -y install gh | ||
|
||
# Install the GitHub runner requirements | ||
RUN cd /home/podman && mkdir actions-runner && cd actions-runner && \ | ||
curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz && \ | ||
tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz && \ | ||
chown -R podman ~podman && /home/podman/actions-runner/bin/installdependencies.sh | ||
|
||
# Set the default working directory to be /home/podman | ||
WORKDIR /home/podman | ||
|
||
# Copy the GitHub runner startup script. | ||
# This script acquires a GitHub runner registration token and requires the repository URL and a User API token | ||
# The two values, REPO & TOKEN, should be provided at container runtime. The API token is sensitive information and should be treated appropriately | ||
COPY start.sh start.sh | ||
|
||
# Make the startup script executable | ||
RUN chmod +x start.sh | ||
|
||
# Change the default user to be podman | ||
USER podman | ||
|
||
# Update PATH to look at the users home directory before looking at the previous PATH values | ||
ENV PATH="/home/podman/.local/bin:$PATH" | ||
|
||
# Set the container primary exectuably to run to be the GitHub runner start script | ||
ENTRYPOINT ["./start.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,19 @@ | ||
#!/bin/bash | ||
|
||
REPO=$REPO | ||
ACCESS_TOKEN=$TOKEN | ||
|
||
REG_TOKEN=$(curl -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/${REPO}/actions/runners/registration-token | jq .token --raw-output) | ||
|
||
cd /home/podman/actions-runner | ||
|
||
./config.sh --url https://github.com/${REPO} --token ${REG_TOKEN} | ||
|
||
cleanup() { | ||
echo "Removing runner..." | ||
./config.sh remove --unattended --token ${REG_TOKEN} | ||
} | ||
trap 'cleanup; exit 130' INT | ||
trap 'cleanup; exit 143' TERM | ||
|
||
./run.sh & wait $1 |