Browse Source

chore: added dockerfile to create github runners

pull/367/head
Parodi, Eugenio 🌶 12 months ago
parent
commit
ef75865ca1
  1. 46
      tools/docker/github-runner/Dockerfile
  2. 25
      tools/docker/github-runner/README.md
  3. 13
      tools/docker/github-runner/script.sh

46
tools/docker/github-runner/Dockerfile

@ -0,0 +1,46 @@
# Use the latest Ubuntu image as the base
# FROM ubuntu:latest
FROM --platform=linux/arm64 ubuntu:latest
# FROM --platform=linux/amd64 ubuntu:latest
# Install required dependencies
RUN apt-get update && apt-get install -y \
sudo \
curl wget tar \
jq git gh \
libicu74 \
&& apt-get clean
RUN echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Switch to the ubuntu user
USER ubuntu
WORKDIR /home/ubuntu
# x86-64
# RUN curl -o actions-runner-linux-x64-2.323.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.323.0/actions-runner-linux-x64-2.323.0.tar.gz
# RUN echo "0dbc9bf5a58620fc52cb6cc0448abcca964a8d74b5f39773b7afcad9ab691e19 actions-runner-linux-x64-2.323.0.tar.gz" | shasum -a 256 -c
# arm-64
RUN curl -o actions-runner-linux-arm64-2.323.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.323.0/actions-runner-linux-arm64-2.323.0.tar.gz
RUN echo "9cb778fffd4c6d8bd74bc4110df7cb8c0122eb62fda30b389318b265d3ade538 actions-runner-linux-arm64-2.323.0.tar.gz" | shasum -a 256 -c
RUN mv actions-runner-linux-* actions-runner-linux.tgz
RUN mkdir -p /home/ubuntu/runner_1
WORKDIR /home/ubuntu/runner_1
RUN tar xzf ../actions-runner-linux.tgz
# # Add this line to accept the token as a build argument
# ARG RUNNER_TOKEN
# # Use the token in the configuration step
# RUN ./config.sh --url https://github.com/ceccopierangiolieugenio/pyTermTk --token ${RUNNER_TOKEN}
COPY script.sh script.sh
RUN sudo chmod +x script.sh
ENTRYPOINT ["./script.sh"]

25
tools/docker/github-runner/README.md

@ -0,0 +1,25 @@
# Build the Docker
```bash
_GITHUB_TOKEN=<your_github_runner_token>
docker build --build-arg RUNNER_TOKEN=${_GITHUB_TOKEN} -t github-runner .
```
# Run the runner
you can spawn as many runner as you want just changing the name
```bash
_GITHUB_TOKEN=<your_github_runner_token>
_RUNNER_NAME=runner_X
docker run -it --rm github-runner ${_GITHUB_TOKEN} ${_RUNNER_NAME}
```
## note:
```bash
_GITHUB_TOKEN=<your_github_runner_token>
./config.sh \
--url https://github.com/ceccopierangiolieugenio/pyTermTk \
--work _work --replace \
--runnergroup Default \
--name test-sh \
--token ${_GITHUB_TOKEN} \
--labels "self-hosted,Linux,ARM64"
```

13
tools/docker/github-runner/script.sh

@ -0,0 +1,13 @@
#!/bin/bash
echo "First input: $1"
echo "Second input: $2"
./config.sh \
--url https://github.com/ceccopierangiolieugenio/pyTermTk \
--work _work --replace \
--runnergroup Default \
--labels "self-hosted,Linux,ARM64" \
--name $2 --token $1
./run.sh
Loading…
Cancel
Save