Compare commits

..

1 Commits

4 changed files with 26 additions and 31 deletions

View File

@ -18,13 +18,13 @@ RUN cd /home/docker && mkdir actions-runner && cd actions-runner \
RUN chown -R docker ~docker && /home/docker/actions-runner/bin/installdependencies.sh RUN chown -R docker ~docker && /home/docker/actions-runner/bin/installdependencies.sh
COPY entrypoint.sh entrypoint.sh COPY start.sh start.sh
# make the script executable # make the script executable
RUN chmod +x entrypoint.sh RUN chmod +x start.sh
# since the config and run script for actions are not allowed to be run by root, # since the config and run script for actions are not allowed to be run by root,
# set the user to "docker" so all subsequent commands are run as the docker user # set the user to "docker" so all subsequent commands are run as the docker user
USER docker USER docker
ENTRYPOINT ["./entrypoint.sh"] ENTRYPOINT ["./start.sh"]

View File

@ -6,8 +6,7 @@ services:
context: . context: .
args: args:
RUNNER_VERSION: 2.323.0 RUNNER_VERSION: 2.323.0
# container_name commented to allow for multiple runners container_name: github-runner
# container_name: github-runner
env_file: env_file:
- .env - .env
volumes: volumes:

View File

@ -1,24 +0,0 @@
#!/bin/bash
REPOSITORY=$REPO
ACCESS_TOKEN=$GH_TOKEN
LABELS=$RUNNER_LABELS
# echo "REPO ${REPOSITORY}"
# echo "ACCESS_TOKEN ${ACCESS_TOKEN}"
REG_TOKEN=$(curl -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/${REPOSITORY}/actions/runners/registration-token | jq .token --raw-output)
cd /home/docker/actions-runner
./config.sh --url https://github.com/${REPOSITORY} --token ${REG_TOKEN} --labels ${LABELS}
cleanup() {
echo "Removing runner..."
./config.sh remove --unattended --token ${REG_TOKEN}
}
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM
./run.sh & wait $!

View File

@ -1,4 +1,24 @@
#!/bin/bash
REPOSITORY=$REPO
ACCESS_TOKEN=$GH_TOKEN
LABELS=$RUNNER_LABELS
docker compose up -d --build # echo "REPO ${REPOSITORY}"
# docker compose up -d --build --scale github-runner=2 # echo "ACCESS_TOKEN ${ACCESS_TOKEN}"
REG_TOKEN=$(curl -X POST -H "Authorization: token ${ACCESS_TOKEN}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/${REPOSITORY}/actions/runners/registration-token | jq .token --raw-output)
cd /home/docker/actions-runner
./config.sh --url https://github.com/${REPOSITORY} --token ${REG_TOKEN} --labels ${LABELS}
cleanup() {
echo "Removing runner..."
./config.sh remove --unattended --token ${REG_TOKEN}
}
trap 'cleanup; exit 130' INT
trap 'cleanup; exit 143' TERM
./run.sh & wait $!