mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: add GPU/CUDA acceleration support (:cuda Docker tag)
Add a :cuda Docker image tag that auto-detects NVIDIA GPU at runtime and falls back gracefully to CPU. Same pattern as Immich. - New gpu.py shared utility for cached CUDA detection - Background removal (rembg): pass CUDAExecutionProvider to ONNX Runtime - Upscaling (Real-ESRGAN): use CUDA device + FP16 when GPU available - OCR (PaddleOCR): enable use_gpu when CUDA detected - Dispatcher reports GPU status at startup via readiness signal - Admin health endpoint exposes GPU availability - Dockerfile uses ARG GPU=false with conditional NVIDIA CUDA base image - docker-compose.gpu.yml override for GPU users - CI/CD workflows build and publish :cuda tag (amd64 only) Three tags: :latest (CPU), :lite (no AI), :cuda (GPU with CPU fallback)
This commit is contained in:
@@ -80,11 +80,20 @@ jobs:
|
||||
- run: pnpm build
|
||||
|
||||
docker:
|
||||
name: Docker Build Test (${{ matrix.variant }})
|
||||
name: Docker Build Test (${{ matrix.tag }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
variant: [full, lite]
|
||||
include:
|
||||
- tag: full
|
||||
variant: full
|
||||
gpu: "false"
|
||||
- tag: lite
|
||||
variant: lite
|
||||
gpu: "false"
|
||||
- tag: cuda
|
||||
variant: full
|
||||
gpu: "true"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -95,7 +104,9 @@ jobs:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
push: false
|
||||
build-args: VARIANT=${{ matrix.variant }}
|
||||
tags: stirling-image:ci-${{ matrix.variant }}
|
||||
cache-from: type=gha,scope=${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|
||||
build-args: |
|
||||
VARIANT=${{ matrix.variant }}
|
||||
GPU=${{ matrix.gpu }}
|
||||
tags: stirling-image:ci-${{ matrix.tag }}
|
||||
cache-from: type=gha,scope=${{ matrix.tag }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.tag }}
|
||||
|
||||
@@ -49,18 +49,28 @@ jobs:
|
||||
fi
|
||||
|
||||
docker:
|
||||
name: Docker (${{ matrix.variant }})
|
||||
name: Docker (${{ matrix.tag }})
|
||||
needs: release
|
||||
if: needs.release.outputs.new_version != ''
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
variant: [full, lite]
|
||||
include:
|
||||
- variant: full
|
||||
- tag: full
|
||||
variant: full
|
||||
gpu: "false"
|
||||
suffix: ""
|
||||
- variant: lite
|
||||
platforms: "linux/amd64,linux/arm64"
|
||||
- tag: lite
|
||||
variant: lite
|
||||
gpu: "false"
|
||||
suffix: "-lite"
|
||||
platforms: "linux/amd64,linux/arm64"
|
||||
- tag: cuda
|
||||
variant: full
|
||||
gpu: "true"
|
||||
suffix: "-cuda"
|
||||
platforms: "linux/amd64"
|
||||
steps:
|
||||
- name: Checkout release tag
|
||||
uses: actions/checkout@v4
|
||||
@@ -97,7 +107,7 @@ jobs:
|
||||
type=semver,pattern={{version}}${{ matrix.suffix }},value=v${{ needs.release.outputs.new_version }}
|
||||
type=semver,pattern={{major}}.{{minor}}${{ matrix.suffix }},value=v${{ needs.release.outputs.new_version }}
|
||||
type=semver,pattern={{major}}${{ matrix.suffix }},value=v${{ needs.release.outputs.new_version }}
|
||||
type=raw,value=${{ matrix.variant == 'full' && 'latest' || 'lite' }}
|
||||
type=raw,value=${{ matrix.tag == 'full' && 'latest' || matrix.tag }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
@@ -105,9 +115,11 @@ jobs:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
push: true
|
||||
build-args: VARIANT=${{ matrix.variant }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VARIANT=${{ matrix.variant }}
|
||||
GPU=${{ matrix.gpu }}
|
||||
platforms: ${{ matrix.platforms }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|
||||
cache-from: type=gha,scope=${{ matrix.tag }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.tag }}
|
||||
|
||||
Reference in New Issue
Block a user