Skip to content

Commit

Permalink
docker: move nvidia to scrypted-common
Browse files Browse the repository at this point in the history
  • Loading branch information
Koushik Dutta authored and Koushik Dutta committed May 3, 2024
1 parent 1594364 commit edfdd5c
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 55 deletions.
62 changes: 61 additions & 1 deletion .github/workflows/docker-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jobs:
build:
name: Push Docker image to Docker Hub
runs-on: self-hosted
# runs-on: ubuntu-latest
strategy:
matrix:
NODE_VERSION: [
Expand Down Expand Up @@ -65,3 +64,64 @@ jobs:
ghcr.io/koush/scrypted-common:${{ matrix.NODE_VERSION }}-${{ matrix.BASE }}-${{ matrix.FLAVOR }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-nvidia:
name: Push NVIDIA Docker image to Docker Hub
needs: build
runs-on: self-hosted
strategy:
matrix:
NODE_VERSION: [
# "18",
"20"
]
BASE: ["jammy"]
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up SSH
uses: MrSquaare/ssh-setup-action@v2
with:
host: ${{ secrets.DOCKER_SSH_HOST_ARM64 }}
private-key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/arm64
append: |
- endpoint: ssh://${{ secrets.DOCKER_SSH_USER }}@${{ secrets.DOCKER_SSH_HOST_ARM64 }}
platforms: linux/arm64
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image (scrypted-common)
uses: docker/build-push-action@v4
with:
build-args: |
NODE_VERSION=${{ matrix.NODE_VERSION }}
BASE=ghcr.io/koush/scrypted-common:${{ matrix.BASE }}-${{ matrix.BASE }}-full
context: install/docker/
file: install/docker/Dockerfile.nvidia
platforms: linux/amd64,linux/arm64
push: true
tags: |
koush/scrypted-common:${{ matrix.NODE_VERSION }}-${{ matrix.BASE }}-nvidia
ghcr.io/koush/scrypted-common:${{ matrix.NODE_VERSION }}-${{ matrix.BASE }}-nvidia
cache-from: type=gha
cache-to: type=gha,mode=max
46 changes: 0 additions & 46 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,49 +93,3 @@ jobs:
${{ github.event.inputs.tag == 'latest' && matrix.BASE == '20-jammy-lite' && matrix.SUPERVISOR == '.s6' && 'ghcr.io/koush/scrypted:lite-s6' || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-nvidia:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: NPM Package Request
id: npm-request
uses: fjogeleit/http-request-action@v1
with:
url: 'https://registry.npmjs.org/@scrypted/server'
method: 'GET'

- name: Set NPM Version
id: package-version
run: echo "NPM_VERSION=${{ fromJson(steps.npm-request.outputs.response)['dist-tags'][ github.event.inputs.tag] }}" >> "$GITHUB_OUTPUT"

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push NVIDIA Docker image
uses: docker/build-push-action@v4
with:
build-args: |
BASE=ghcr.io/koush/scrypted:20-jammy-full.s6-v${{ steps.package-version.outputs.NPM_VERSION }}
context: install/docker/
file: install/docker/Dockerfile.nvidia
push: true
tags: |
koush/scrypted:nvidia-v${{ steps.package-version.outputs.NPM_VERSION }}
${{ github.event.inputs.tag == 'latest' && 'koush/scrypted:nvidia' || '' }}
ghcr.io/koush/scrypted:nvidia-v${{ steps.package-version.outputs.NPM_VERSION }}
${{ github.event.inputs.tag == 'latest' && 'ghcr.io/koush/scrypted:nvidia' || '' }}
12 changes: 4 additions & 8 deletions install/docker/Dockerfile.nvidia
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
ARG BASE="ghcr.io/koush/scrypted"
ARG BASE="ghcr.io/koush/scrypted-common:20-jammy-full"
FROM $BASE
ARG CUDA_VERSION=12-4

RUN apt update -q \
&& apt install wget \
&& wget -qO /cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
&& dpkg -i /cuda-keyring.deb \
&& apt update -q \
&& apt install -y cuda-nvcc-$CUDA_VERSION libcublas-$CUDA_VERSION libcudnn8 cuda-libraries-$CUDA_VERSION
# nvidia cudnn/libcublas etc.
# for some reason this is not provided by the nvidia container toolkit
RUN curl https://raw.githubusercontent.com/koush/scrypted/main/install/docker/install-nvidia-graphics.sh | bash
16 changes: 16 additions & 0 deletions install/docker/install-nvidia-graphics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if [ "$(uname -m)" = "x86_64" ]
then
export CUDA_VERSION=12-4
echo "Installing NVIDIA graphics packages."
apt update -q \
&& apt install wget \
&& wget -qO /cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
&& dpkg -i /cuda-keyring.deb \
&& apt update -q \
&& apt install -y cuda-nvcc-$CUDA_VERSION libcublas-$CUDA_VERSION libcudnn8 cuda-libraries-$CUDA_VERSION;
exit $?
else
echo "NVIDIA graphics will not be installed on this architecture."
fi

exit 0

0 comments on commit edfdd5c

Please sign in to comment.