Last active
May 11, 2021 13:03
-
-
Save knrt10/66868b1819f5000e52654f6693d84c4e to your computer and use it in GitHub Desktop.
Deployment to install actions runner on Debian based machine
This file contains 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: github-action-runner | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: github-action-runner | |
strategy: {} | |
template: | |
metadata: | |
labels: | |
app: github-action-runner | |
spec: | |
containers: | |
- image: nginx | |
name: github-action-runner | |
resources: {} | |
env: | |
- name: RUNNER_ALLOW_RUNASROOT | |
value: "1" | |
securityContext: | |
runAsUser: 0 | |
privileged: true | |
volumeMounts: | |
- mountPath: /var/run | |
name: docker-sock | |
command: | |
- /bin/bash | |
- -c | |
- | | |
# Install docker in debian | |
set -euo pipefail | |
set -x | |
# Source: https://docs.docker.com/engine/install/debian | |
apt-get update | |
apt-get -y remove docker docker-engine docker.io containerd runc || true | |
apt-get -y install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release | |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo \ | |
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt-get update | |
apt-get install -y docker-ce docker-ce-cli containerd.io | |
# Create a folder for action runner | |
mkdir actions-runner && cd actions-runner | |
# Download the latest runner package | |
curl -O -L https://github.com/actions/runner/releases/download/v2.272.0/actions-runner-linux-x64-2.272.0.tar.gz | |
# Extract the installer | |
tar xzf ./actions-runner-linux-x64-2.272.0.tar.gz && sleep 365000d | |
volumes: | |
- name: docker-sock | |
hostPath: | |
path: /var/run | |
status: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment