Skip to content

Commit

Permalink
chore: colocate custom runner dockerfiles next to manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
invakid404 committed Aug 29, 2023
1 parent dead59c commit dead499
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build-actions-runner-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build Actions Runner Images
on:
push:
branches:
- main
paths:
- apps/actions-runner-controller/runners/**
schedule:
- cron: "0 0 * * 0"

env:
REGISTRY: ghcr.io

jobs:
build-matrix:
name: Build Matrix
runs-on: self-hosted
outputs:
contexts: ${{ steps.find-dockerfiles.outputs.contexts }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Find all Dockerfiles to build
id: find-dockerfiles
run: |
CONTEXTS=$(find apps/actions-runner-controller/runners \
-name Dockerfile -printf '%h\n' | \
jq -R -s -c 'split("\n")[:-1]')
echo "contexts=${CONTEXTS}" >> "${GITHUB_OUTPUT}"
build-image:
name: Build Image
runs-on: self-hosted
needs:
- build-matrix
permissions:
contents: read
packages: write
strategy:
matrix:
context: ${{ fromJSON(needs.build-matrix.outputs.contexts) }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build image name
id: image-name
env:
context: ${{ matrix.context }}
run: |
echo "name=${context#apps/actions-runner-controller/runners/}" >> "${GITHUB_OUTPUT}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ matrix.context }}
push: true
tags: ${{ env.REGISTRY }}/invakid404/runners/${{ steps.image-name.outputs.name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 4 additions & 0 deletions apps/actions-runner-controller/runners/abcccid/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM summerwind/actions-runner:latest

COPY install-deps.sh .
RUN ./install-deps.sh
17 changes: 17 additions & 0 deletions apps/actions-runner-controller/runners/abcccid/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo add-apt-repository ppa:mozillateam/ppa
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox

sudo apt update
sudo apt install -y jq firefox

json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
url=$(printf "%s" "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64") and endswith("gz"))')
curl -s -L "$url" | sudo tar -xz
sudo chmod +x geckodriver
sudo mv geckodriver /usr/bin/

ls -la /usr/bin/geckodriver

0 comments on commit dead499

Please sign in to comment.