Skip to content

Commit

Permalink
feat: add gpu-screen-recorder in its own Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
wanjohiryan committed Apr 3, 2024
1 parent 800c013 commit 407c73b
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 163 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/recorder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#Tabs not spaces, you moron :)

name: CI for netris:recorder

on:
pull_request:
paths:
- "recorder.Dockerfile"
- ".github/workflows/recorder.yml"
schedule:
- cron: 0 0 * * * # At the end of everyday
push:
branches: [main]
paths:
- "recorder.Dockerfile"
- ".github/workflows/recorder.yml"
tags:
- v*.*.*
release:
types: [created]

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: wanjohiryan/netris
BASE_TAG_PREFIX: recorder

jobs:
build-docker-pr:
name: Build image on pr
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
-
name: Checkout repo
uses: actions/checkout@v4
-
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build Docker image
uses: docker/build-push-action@v5
with:
file: recorder.Dockerfile
context: ./
push: false
load: true
tags: netris:recorder

build-docker-main:
name: Build image on merge
if: ${{github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
-
name: Checkout repo
uses: actions/checkout@v4
-
name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract Container metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BASE_TAG_PREFIX }}
#
#tag on release, and a nightly build for 'dev'
tags: |
type=raw,value=nightly,enable={{is_default_branch}}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
-
name: Build Docker image
uses: docker/build-push-action@v5
with:
file: recorder.Dockerfile
context: ./
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
54 changes: 54 additions & 0 deletions recorder.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This builds and updates the screen recorder we use on Netris
# From https://git.dec05eba.com/gpu-screen-recorder
FROM ubuntu:23.10

ENV DEBIAN_FRONTEND=noninteractive

#Build and install gpu-screen-recorder
#TODO: Install ffmpeg
RUN apt-get update -y \
&& apt-get install -y \
curl \
unzip \
git \
build-essential \
ninja-build \
gcc \
meson \
cmake \
ccache \
bison \
equivs \
ca-certificates\
libcap2-bin \
libllvm15 \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libx11-dev \
libxcomposite-dev \
libxrandr-dev \
libxfixes-dev \
libpulse-dev \
libswresample-dev \
libavfilter-dev \
libva-dev \
libcap-dev \
libdrm-dev \
libgl-dev \
libegl-dev \
libwayland-dev \
libwayland-egl-backend-dev \
wayland-protocols \
&& rm -rf /var/lib/apt/lists/* \
#Install Cuda
&& cd /tmp && curl -fsSL -o nvidia_cuda_nvrtc_linux_x86_64.whl "https://developer.download.nvidia.com/compute/redist/nvidia-cuda-nvrtc/nvidia_cuda_nvrtc-11.0.221-cp36-cp36m-linux_x86_64.whl" \
&& unzip -joq -d ./nvrtc nvidia_cuda_nvrtc_linux_x86_64.whl && cd nvrtc && chmod 755 libnvrtc* \
&& find . -maxdepth 1 -type f -name "*libnvrtc.so.*" -exec sh -c 'ln -snf $(basename {}) libnvrtc.so' \; \
&& mkdir -p /usr/local/nvidia/lib && mv -f libnvrtc* /usr/local/nvidia/lib \
&& echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
&& git clone https://repo.dec05eba.com/gpu-screen-recorder && cd gpu-screen-recorder \
&& chmod +x ./build.sh ./install.sh \
&& ./install.sh \
#Test
&& /usr/bin/gpu-screen-recorder --help
Loading

0 comments on commit 407c73b

Please sign in to comment.