From af9d561f1a661b510318770c3cae13c74e7da243 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Wed, 13 Dec 2023 23:10:12 +0100 Subject: [PATCH] alpine: gitea-act_runner --- .../apps/gitea-act_runner/gitea-act_runner.sh | 75 +++++++++++++++++++ alpine/init.sh | 1 + 2 files changed, 76 insertions(+) create mode 100644 alpine/apps/gitea-act_runner/gitea-act_runner.sh diff --git a/alpine/apps/gitea-act_runner/gitea-act_runner.sh b/alpine/apps/gitea-act_runner/gitea-act_runner.sh new file mode 100644 index 0000000..5843802 --- /dev/null +++ b/alpine/apps/gitea-act_runner/gitea-act_runner.sh @@ -0,0 +1,75 @@ +#!/bin/dash + +GITEA_INSTANCE_URL="" +GITEA_INSTANCE_URL=$(whiptail --title "GITEA_INSTANCE_URL" --inputbox "" 0 30 "${GITEA_INSTANCE_URL}" 3>&1 1>&2 2>&3) +GITEA_RUNNER_REGISTRATION_TOKEN="" +GITEA_RUNNER_REGISTRATION_TOKEN=$(whiptail --title "GITEA_RUNNER_REGISTRATION_TOKEN" --inputbox "" 0 30 "${GITEA_RUNNER_REGISTRATION_TOKEN}" 3>&1 1>&2 2>&3) +IMAGES="" + +if [ "${GITEA_INSTANCE_URL}" = "" ] || [ "${GITEA_RUNNER_REGISTRATION_TOKEN}" = "" ]; then + exit 1 +fi + +apk add docker docker-compose +rc-update add docker boot +service docker start + +mkdir -p /srv/compose +mkdir -p /srv/data + + +SelectImages() { + SEL=$(whiptail --title "Images" --checklist "" 0 0 0 \ + "debian-bookworm" "" on \ + "debian-bookworm-slim" "" on \ + "debian-bullseye" "" on \ + "debian-bullseye-slim" "" on \ + "debian-buster" "" on \ + "debian-buster-slim" "" on \ + "archlinux" "" on \ + "archlinux-base-devel" "" on 3>&1 1>&2 2>&3) + # shellcheck disable=SC2181 + if [ "${?}" = "0" ]; then + for ITM in ${SEL}; do + # shellcheck disable=SC3000-SC4000 + case ${ITM//\"/} in + "alpine") IMAGES+='"alpine:docker://alpine",';; + "debian-bookworm") IMAGES+='"debian-bookworm:docker://debian:bookworm",';; + "debian-bookworm-slim") IMAGES+='"debian-bookworm-slim:docker://debian:bookworm-slim",';; + "debian-bullseye") IMAGES+='"debian-bullseye:docker://debian:bullseye",';; + "debian-bullseye-slim") IMAGES+='"debian-bullseye-slim:docker://debian:bullseye-slim",';; + "debian-buster") IMAGES+='"debian-buster:docker://debian:buster",';; + "debian-buster-slim") IMAGES+='"debian-buster-slim:docker://debian:buster-slim",';; + "archlinux") IMAGES+='"archlinux:docker://archlinux",';; + "archlinux-base-devel") IMAGES+='"archlinux-base-devel:docker://archlinux:base-devel",';; + esac + done + # shellcheck disable=SC2027 + IMAGES="["$(printf '%s' "${IMAGES}" | cut -c 1)"]" + fi +} +SelectImages + +{ + echo "runner:" + echo " insecure: true" + echo " labels: ${IMAGES}]" +} > /srv/data/config.yaml + +{ + echo "services:" + echo " runner:" + echo " container_name: gitea-act_runner" + echo " image: gitea/act_runner:latest" + echo " restart: unless-stopped" + echo " volumes:" + echo " - /srv/data:/data" + echo " - /var/run/docker.sock:/var/run/docker.sock" + echo " environment:" + echo " - CONFIG_FILE=/data/config.yaml" + echo " - GITEA_INSTANCE_URL=${GITEA_INSTANCE_URL}" + echo " - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN}" +} > /srv/compose/compose.yaml + +cd /srv/compose || exit 1 +docker-compose up -d diff --git a/alpine/init.sh b/alpine/init.sh index 20b5663..2049ae1 100644 --- a/alpine/init.sh +++ b/alpine/init.sh @@ -134,6 +134,7 @@ InstApps() { SEL=$(whiptail --title "More Apps" --checklist "" 0 0 0 \ "traefik" "" off \ "gitea" "" off \ + "gitea-act_runner" "" off\ "docker" "" off \ "portainer" "" off \ "rancher" "" off 3>&1 1>&2 2>&3)