Download entrypoint.sh from wulukewu/gitlab-runner-docker-hf: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/spaces/wulukewu/gitlab-runner-docker-hf/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/wulukewu/gitlab-runner-docker-hf/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/wulukewu/gitlab-runner-docker-hf/resolve/main/entrypoint.sh
2.19 kB
| set -e | |
| if [ -z "$RUNNER_TOKEN" ]; then | |
| echo "ERROR: RUNNER_TOKEN is required" | |
| exit 1 | |
| fi | |
| GITLAB_URL="${GITLAB_URL:-https://gitlab.com}" | |
| RUNNER_NAME="${RUNNER_NAME:-gitlab-runner}" | |
| RUNNER_EXECUTOR="${RUNNER_EXECUTOR:-shell}" | |
| RUNNER_DOCKER_IMAGE="${RUNNER_DOCKER_IMAGE:-docker:24.0.5}" | |
| RUNNER_DOCKER_PRIVILEGED="${RUNNER_DOCKER_PRIVILEGED:-true}" | |
| RUNNER_CONCURRENT="${RUNNER_CONCURRENT:-2}" | |
| RUNNER_CHECK_INTERVAL="${RUNNER_CHECK_INTERVAL:-0}" | |
| RUNNER_DOCKER_VOLUMES="${RUNNER_DOCKER_VOLUMES:-/var/run/docker.sock:/var/run/docker.sock,/cache,/certs/client}" | |
| RUNNER_DOCKER_SHM_SIZE="${RUNNER_DOCKER_SHM_SIZE:-0}" | |
| RUNNER_TLS_VERIFY="${RUNNER_TLS_VERIFY:-false}" | |
| CONFIG_DIR="${HOME}/.gitlab-runner" | |
| CONFIG_FILE="${CONFIG_DIR}/config.toml" | |
| mkdir -p "$CONFIG_DIR" | |
| VOLUMES="" | |
| OLD_IFS="$IFS" | |
| IFS=',' | |
| for vol in $RUNNER_DOCKER_VOLUMES; do | |
| VOLUMES="${VOLUMES}\"${vol}\", " | |
| done | |
| IFS="$OLD_IFS" | |
| VOLUMES="[${VOLUMES%, }]" | |
| cat > "$CONFIG_FILE" <<EOF | |
| concurrent = ${RUNNER_CONCURRENT} | |
| check_interval = ${RUNNER_CHECK_INTERVAL} | |
| shutdown_timeout = 0 | |
| [session_server] | |
| session_timeout = 1800 | |
| EOF | |
| COUNTER=1 | |
| OLD_IFS="$IFS" | |
| IFS=',' | |
| for token in $RUNNER_TOKEN; do | |
| token=$(echo "$token" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') | |
| cat >> "$CONFIG_FILE" <<EOF | |
| [[runners]] | |
| name = "${RUNNER_NAME}-${COUNTER}" | |
| url = "${GITLAB_URL}" | |
| token = "${token}" | |
| executor = "${RUNNER_EXECUTOR}" | |
| EOF | |
| if [ "$RUNNER_EXECUTOR" = "docker" ]; then | |
| cat >> "$CONFIG_FILE" <<EOF | |
| [runners.docker] | |
| tls_verify = ${RUNNER_TLS_VERIFY} | |
| image = "${RUNNER_DOCKER_IMAGE}" | |
| privileged = ${RUNNER_DOCKER_PRIVILEGED} | |
| disable_entrypoint_overwrite = false | |
| oom_kill_disable = false | |
| disable_cache = false | |
| volumes = ${VOLUMES} | |
| shm_size = ${RUNNER_DOCKER_SHM_SIZE} | |
| EOF | |
| fi | |
| cat >> "$CONFIG_FILE" <<EOF | |
| [runners.cache] | |
| MaxUploadedArchiveSize = 0 | |
| EOF | |
| COUNTER=$((COUNTER + 1)) | |
| done | |
| IFS="$OLD_IFS" | |
| echo "========== Generated config.toml ==========" | |
| cat "$CONFIG_FILE" | |
| echo "============================================" | |
| export RUNNER_SYSTEM_ID="runner-$(echo "${RUNNER_NAME}" | md5sum | cut -c1-12)" | |
| exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf | |