This commit is contained in:
2025-10-14 11:09:08 +02:00
commit 6e3589c0b6
3 changed files with 53 additions and 0 deletions

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y curl jq git sudo
# Create a non-root user runneruser
RUN useradd -m runneruser && echo "runneruser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN mkdir -p /actions-runner
WORKDIR /actions-runner
COPY actions-runner.tar.gz actions-runner.tar.gz
RUN tar xzf ./actions-runner.tar.gz
RUN ./bin/installdependencies.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Change ownership of the runner directory to the non-root user
RUN chown -R runneruser:runneruser /actions-runner
# Switch to non-root user
USER runneruser
ENTRYPOINT ["/entrypoint.sh"]

16
docker-compose.yml Normal file
View File

@@ -0,0 +1,16 @@
services:
github-runner:
build: .
container_name: github-runner
environment:
RUNNER_TOKEN: "YourToken"
OWNER: "Your GitHub name"
REPO: "Your Repository name"
restart: unless-stopped
networks:
- net
networks:
net:
name: docker_public
external: true

13
entrypoint.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Check required env variables
if [ -z "$OWNER" ] || [ -z "$REPO" ] || [ -z "$RUNNER_TOKEN" ]; then
echo "Missing OWNER, REPO, or RUNNER_TOKEN environment variables."
exit 1
fi
# Configure the runner
./config.sh --url https://github.com/${OWNER}/${REPO} --token $RUNNER_TOKEN
# Run the runner
./run.sh