Skip to content

Commit 2aa7add

Browse files
committed
feat: First Release
1 parent afa6440 commit 2aa7add

File tree

7 files changed

+234
-0
lines changed

7 files changed

+234
-0
lines changed

.github/workflows/publish.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
tags:
7+
- '**'
8+
workflow_dispatch:
9+
10+
jobs:
11+
push_to_registry:
12+
name: Push Docker image to Docker Hub
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v4
17+
18+
- name: Log in to Docker Hub
19+
uses: docker/login-action@v3
20+
with:
21+
username: ${{ secrets.DOCKER_USERNAME }}
22+
password: ${{ secrets.DOCKER_PASSWORD }}
23+
24+
- name: Extract metadata (tags, labels) for Docker
25+
id: meta
26+
uses: docker/metadata-action@v5
27+
with:
28+
images: scalified/github-actions-runner
29+
tags: |
30+
type=raw,value=latest
31+
type=semver,pattern={{version}}
32+
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v6
35+
with:
36+
context: .
37+
build-args: >-
38+
${{ steps.meta.outputs.version != 'latest'
39+
&& format('ACTIONS_RUNNER_VERSION={0}', steps.meta.outputs.version) || '' }}
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}
43+

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM debian:bookworm-slim
2+
3+
LABEL maintainer="Scalified <[email protected]>"
4+
5+
ARG ACTIONS_RUNNER_VERSION="2.327.1"
6+
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV RUNNER_ALLOW_RUNASROOT="1"
9+
10+
RUN apt update && \
11+
apt install -y --no-install-recommends \
12+
ca-certificates \
13+
curl \
14+
wget \
15+
git \
16+
gnupg \
17+
lsb-release \
18+
libicu72 \
19+
supervisor && \
20+
apt clean && \
21+
rm -rf /var/lib/apt/lists/*
22+
23+
RUN mkdir -p /etc/apt/keyrings && \
24+
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
25+
chmod a+r /etc/apt/keyrings/docker.asc && \
26+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
27+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
28+
29+
RUN apt update && \
30+
apt install -y --no-install-recommends \
31+
docker-ce && \
32+
apt clean && \
33+
rm -rf /var/lib/apt/lists/*
34+
35+
WORKDIR /opt/actions-runner
36+
37+
RUN curl -sSLo actions-runner.tar.gz "https://github.com/actions/runner/releases/download/v${ACTIONS_RUNNER_VERSION}/actions-runner-linux-x64-${ACTIONS_RUNNER_VERSION}.tar.gz" \
38+
&& tar -zxvf actions-runner.tar.gz \
39+
&& rm -rf actions-runner.tar.gz
40+
41+
COPY etc /etc/
42+
COPY usr /usr/
43+
44+
ENTRYPOINT ["supervisord", "-c", "/etc/supervisord.conf"]
45+

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# GitHub Actions Runner Docker Image
2+
3+
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Scalified/helm-jboss/blob/master/LICENSE)
4+
[![Docker Pulls](https://img.shields.io/docker/pulls/scalified/github-actions-runner.svg)](https://hub.docker.com/r/scalified/github-actions-runner)
5+
[![Release](https://img.shields.io/github/v/release/Scalified/docker-github-actions-runner?style=flat-square)](https://github.com/Scalified/docker-github-actions-runner/releases/latest)
6+
7+
## Overview
8+
9+
**Docker** image with **Docker-in-Docker (DinD)** and **GitHub Actions Runner** managed by **Supervisor**, enabling container execution without extra setup
10+
11+
## Usage
12+
13+
1. Add a new [`GitHub Actions Runner`](https://github.com/organizations/${GITHUB_ORG_NAME}/settings/actions/runners)
14+
2. Copy the runner token (`$GITHUB_ACTIONS_RUNNER_TOKEN`) from the runner’s details page
15+
3. Run the `scalified/github-actions-runner` Docker image:
16+
17+
```
18+
docker run \
19+
-d \
20+
--name scv-gh-ar-1 \
21+
--hostname scv-gh-ar-1 \
22+
--restart unless-stopped \
23+
--privileged \
24+
-e GITHUB_ORG_URL=https://github.com/$GITHUB_ORG_NAME \
25+
-e GITHUB_ACTIONS_RUNNER_TOKEN=$GITHUB_ACTIONS_RUNNER_TOKEN \
26+
scalified/github-actions-runner
27+
```
28+
29+
| Environment Variable | Description |
30+
|-------------------------------|---------------------------------------------------------------------|
31+
| `GITHUB_ORG_URL` | **GitHub** organization URL: `https://github.com/$GITHUB_ORG_NAME` |
32+
| `GITHUB_ACTIONS_RUNNER_TOKEN` | **GitHub Actions Runner** token displayed after adding a new runner |
33+
34+
35+
---
36+
37+
**Made with ❤️ by [Scalified](http://www.scalified.com)**
38+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[program:actions-runner]
2+
command=actions-runner
3+
priority=3
4+
autostart=true
5+
autorestart=true
6+
startsecs=15
7+
stdout_logfile=/dev/stdout
8+
stdout_logfile_maxbytes=0
9+
stdout_logfile_backups=0
10+
stdout_capture_maxbytes=0
11+
stdout_events_enabled=true
12+
stdout_syslog=false
13+
stderr_logfile=/dev/stderr
14+
stderr_logfile_maxbytes=0
15+
stderr_logfile_backups=0
16+
stderr_capture_maxbytes=0
17+
stderr_events_enabled=true
18+
stderr_syslog=false
19+

etc/supervisor.d/docker.ini

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[program:docker]
2+
command=dockerd --storage-driver=vfs
3+
priority=2
4+
autostart=true
5+
autorestart=true
6+
startsecs=10
7+
stdout_logfile=/dev/stdout
8+
stdout_logfile_maxbytes=0
9+
stdout_logfile_backups=0
10+
stdout_capture_maxbytes=0
11+
stdout_events_enabled=true
12+
stdout_syslog=false
13+
stderr_logfile=/dev/stderr
14+
stderr_logfile_maxbytes=0
15+
stderr_logfile_backups=0
16+
stderr_capture_maxbytes=0
17+
stderr_events_enabled=true
18+
stderr_syslog=false
19+

etc/supervisord.conf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
; Sample supervisor config file.
2+
;
3+
; For more information on the config file, please see:
4+
; http://supervisord.org/configuration.html
5+
;
6+
; Notes:
7+
; - Shell expansion ("~" or "$HOME") is not supported. Environment
8+
; variables can be expanded using this syntax: "%(ENV_HOME)s".
9+
; - Quotes around values are not supported, except in the case of
10+
; the environment= options as shown below.
11+
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
12+
; - Command will be truncated if it looks like a config file comment, e.g.
13+
; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
14+
;
15+
; Warning:
16+
; Paths throughout this example file use /tmp because it is available on most
17+
; systems. You will likely need to change these to locations more appropriate
18+
; for your system. Some systems periodically delete older files in /tmp.
19+
; Notably, if the socket file defined in the [unix_http_server] section below
20+
; is deleted, supervisorctl will be unable to connect to supervisord.
21+
22+
[supervisord]
23+
logfile=/dev/stdout ; main log file; default $CWD/supervisord.log
24+
logfile_maxbytes=0 ; max main logfile bytes b4 rotation; default 50MB
25+
logfile_backups=0 ; # of main logfile backups; 0 means none, default 10
26+
loglevel=info ; log level; default info; others: debug,warn,trace
27+
pidfile=/run/supervisord.pid ; supervisord pidfile; default supervisord.pid
28+
nodaemon=true ; start in foreground if true; default false
29+
silent=true ; no logs to stdout if true; default false
30+
minfds=1024 ; min. avail startup file descriptors; default 1024
31+
minprocs=200 ; min. avail process descriptors;default 200
32+
umask=022 ; process file creation umask; default 022
33+
user=root ; setuid to this UNIX account at startup; recommended if root
34+
identifier=supervisor ; supervisord identifier, default is 'supervisor'
35+
;directory=/tmp ; default is not to cd during start
36+
;nocleanup=true ; don't clean up tempfiles at start; default false
37+
;childlogdir=/var/log/supervisor ; 'AUTO' child log dir, default $TEMP
38+
;environment=KEY="value" ; key value pairs to add to environment
39+
;strip_ansi=false ; strip ansi escape codes in logs; def. false
40+
41+
; The [include] section can just contain the "files" setting. This
42+
; setting can list multiple files (separated by whitespace or
43+
; newlines). It can also contain wildcards. The filenames are
44+
; interpreted as relative to this file. Included files *cannot*
45+
; include files themselves.
46+
47+
[include]
48+
files = /etc/supervisor.d/*.ini
49+

usr/local/sbin/actions-runner

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
if [ -z "$GITHUB_ORG_URL" ]; then
4+
echo "ERROR 'GITHUB_ORG_URL' environment variable undefined"
5+
exit 1
6+
fi
7+
8+
if [ -z "$GITHUB_ACTIONS_RUNNER_TOKEN" ]; then
9+
echo "ERROR 'GITHUB_TOKEN' environment variable undefined"
10+
exit 1
11+
fi
12+
13+
./config.sh \
14+
--name $(hostname) \
15+
--unattended \
16+
--replace \
17+
--url "$GITHUB_ORG_URL" \
18+
--token "$GITHUB_ACTIONS_RUNNER_TOKEN"
19+
20+
./run.sh
21+

0 commit comments

Comments
 (0)