Merge pull request #3 from mjun0812/feature/add-self-hosted-runner

[WIP] Add self hosted runner
This commit is contained in:
Junya Morioka
2025-05-17 03:04:49 +09:00
committed by GitHub
5 changed files with 97 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
name: "Docker and container hooks test"
on:
workflow_dispatch:
jobs:
docker:
runs-on:
- self-hosted
timeout-minutes: 10
container:
image: docker:dind
steps:
- name: Show docker info
run: |
docker -v
docker info
docker ps
- run: ls
- run: pwd
+2
View File
@@ -0,0 +1,2 @@
.DS_Store
.env
+61
View File
@@ -0,0 +1,61 @@
FROM ubuntu:latest
ARG REPOSITORY_URL
ARG PERSONAL_ACCESS_TOKEN
ARG GH_RUNNER_VERSION="2.324.0"
ARG RUNNER_NAME="self-hosted-github-actions-runner"
ARG RUNNER_GROUP="default"
ARG RUNNER_LABELS="self-hosted,Linux"
ARG TARGET_ARCH="x64"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends\
curl \
ca-certificates \
sudo \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# Install Docker cli
RUN install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \
&& chmod a+r /etc/apt/keyrings/docker.asc \
# Add the repository to Apt sources:
&& echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
docker-ce-cli \
&& rm -rf /var/lib/apt/lists/*
# Install dotnet
RUN add-apt-repository ppa:dotnet/backports
# Create runner user and setup group
RUN useradd -mr -d /home/runner runner \
&& usermod -aG sudo runner
# Allow sudo without password
RUN echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
USER runner
WORKDIR /home/runner
RUN mkdir -p /home/runner/actions-runner \
&& curl -fsSL -o actions-runner.tar.gz -L "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-${TARGET_ARCH}-${GH_RUNNER_VERSION}.tar.gz" \
&& tar xf actions-runner.tar.gz \
&& rm actions-runner.tar.gz \
&& sudo ./bin/installdependencies.sh \
&& ./config.sh \
--unattended \
--url $REPOSITORY_URL \
--pat $PERSONAL_ACCESS_TOKEN \
--name $RUNNER_NAME \
--runnergroup $RUNNER_GROUP \
--labels "${RUNNER_LABELS},${TARGET_ARCH}" \
--work /home/runner/actions-runner
CMD ["./run.sh"]
+14
View File
@@ -0,0 +1,14 @@
services:
runner:
build:
context: .
dockerfile: Dockerfile
args:
PERSONAL_ACCESS_TOKEN: $PERSONAL_ACCESS_TOKEN
REPOSITORY_URL: https://github.com/mjun0812/flash-attention-prebuild-wheels
RUNNER_NAME: self-hosted-runner
RUNNER_GROUP: default
RUNNER_LABELS: self-hosted
TARGET_ARCH: x64
volumes:
- /var/run/docker.sock:/var/run/docker.sock
+1
View File
@@ -0,0 +1 @@
PERSONAL_ACCESS_TOKEN=