diff --git a/Dockerfile b/Dockerfile index 101c88b..5fa0f66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ # base -FROM ubuntu:18.04 +FROM ubuntu:20.04 # set the github runner version ARG RUNNER_VERSION="2.283.1" ARG RUNNER_ARCH="arm" # update the base packages and add a non-sudo user +ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/Berlin" RUN apt-get update -y && apt-get upgrade -y && useradd -m docker # install python and the packages the your code depends on along with jq so we can parse JSON @@ -25,7 +26,7 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | g # https://docs.docker.com/engine/install/ubuntu/ RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \ && echo "deb [arch=armhf signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ - && apt-get update -y && apt-get install -y docker-ce docker-ce-cli containerd.io + && apt-get update -y && apt-get install -y docker-compose containerd.io # install pkg-config libsqlite3-dev RUN apt-get update -y && apt-get install -y pkg-config libsqlite3-dev diff --git a/start.sh b/start.sh index 521491e..bf2b2df 100644 --- a/start.sh +++ b/start.sh @@ -14,16 +14,22 @@ REG_TOKEN=$(curl -sX POST -H "Authorization: token ${ACCESS_TOKEN}" https://api. # Configure the runner cd /home/docker/actions-runner -gosu docker ./config.sh --url https://github.com/${ORGANIZATION} --token ${REG_TOKEN} +gosu docker ./config.sh --url https://github.com/${ORGANIZATION} --token ${REG_TOKEN} \ + --name "${NAME}" \ + --labels "${LABELS}" \ + --runnergroup "${GROUP}" \ + --unattended \ + --replace # Trap signals and cleanup cleanup() { echo "Removing runner..." gosu docker ./config.sh remove --unattended --token ${REG_TOKEN} + exit } -trap 'cleanup; exit 130' INT -trap 'cleanup; exit 143' TERM +# Deregister runner on exit +trap cleanup SIGINT SIGQUIT SIGTERM INT TERM QUIT # Set the docker permissions echo "Setting docker permissions..." @@ -31,5 +37,6 @@ if [ -e "/var/run/docker.sock" ] ; then chmod 666 /var/run/docker.sock fi -# Run the runner -gosu docker ./run.sh & wait $! +# Run +gosu docker ./run.sh +