Last active
July 25, 2025 18:14
-
-
Save 0xAungkon/c06129eaaa1ac1a621953233a6675593 to your computer and use it in GitHub Desktop.
Github Action Runner Docker Instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM debian:bookworm | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| curl \ | |
| unzip \ | |
| ca-certificates \ | |
| gnupg \ | |
| libicu72 \ | |
| libkrb5-3 \ | |
| libssl3 \ | |
| libcurl4 \ | |
| libunwind8 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user | |
| RUN useradd -m -s /bin/bash runner | |
| WORKDIR /home/runner/actions-runner | |
| ENV RUNNER_VERSION=2.327.0 \ | |
| RUNNER_ARCH=linux-x64 \ | |
| RUNNER_FILENAME=actions-runner-linux-x64-2.327.0.tar.gz | |
| RUN curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/${RUNNER_FILENAME} && \ | |
| tar xzf ${RUNNER_FILENAME} && \ | |
| rm ${RUNNER_FILENAME} && \ | |
| chown -R runner:runner /home/runner/actions-runner | |
| USER runner | |
| ENTRYPOINT ["bash", "-c", "./config.sh --url $GITHUB_REPO_URL --token $GITHUB_RUNNER_TOKEN --unattended && ./run.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if [ $# -ne 2 ]; then | |
| echo "Usage: $0 <github_repo_url> <github_token>" | |
| exit 1 | |
| fi | |
| REPO_URL="$1" | |
| GITHUB_TOKEN="$2" | |
| REPO_NAME=runner_$(basename "$REPO_URL" | tr '[:upper:]' '[:lower:]') | |
| docker stop $REPO_NAME | |
| docker rm $REPO_NAME | |
| docker run -d --restart=always \ | |
| -e GITHUB_REPO_URL=$REPO_URL \ | |
| -e GITHUB_RUNNER_TOKEN=$GITHUB_TOKEN \ | |
| --name $REPO_NAME \ | |
| github-runner:2.327.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment