proof of concept for nvidia gpu passthrough

This commit is contained in:
ZebRawnsley 2023-03-15 11:38:39 +13:00
parent e69933d525
commit 5d2f6ea3bc
4 changed files with 53 additions and 21 deletions

View file

@ -32,7 +32,7 @@ docker_stage: wheel
cp dist/*.whl docker/root/
cp -R examples docker/root/defaults/
docker: docker_stage
sudo docker build --no-cache -t ytdl-sub:local docker/
sudo docker build --progress=plain --no-cache -t ytdl-sub:local docker/
executable: clean
pyinstaller ytdl-sub.spec
mv dist/ytdl-sub dist/ytdl-sub${EXEC_SUFFIX}

19
dev-compose.yml Normal file
View file

@ -0,0 +1,19 @@
version: '3.9'
services:
ytdl-sub:
image: ytdl-sub:local
container_name: ytdl-sub
environment:
- DOCKER_MODS=linuxserver/mods:universal-cron
- NVIDIA_DRIVER_CAPABILITIES=all
- NVIDIA_VISIBLE_DEVICES=all
volumes:
- '$PWD/config:/config'
- '$PWD/tv:/tv_shows'
- '$PWD/working:/working'
restart: unless-stopped
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]

View file

@ -1,29 +1,41 @@
FROM ghcr.io/linuxserver/baseimage-alpine:3.17
FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
ARG DEBIAN_FRONTEND=noninteractive
# https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
###############################################################################
# YTDL-SUB INSTALL
COPY root/ /
RUN mkdir -p /config && \
apk update --no-cache && \
apk upgrade --no-cache && \
apk add --no-cache --repository=http://dl-3.alpinelinux.org/alpine/edge/main/ \
apt-get -y update && \
apt-get -y upgrade && \
apt-get install --no-install-recommends -y \
software-properties-common && \
add-apt-repository ppa:savoury1/ffmpeg4 && \
add-apt-repository ppa:savoury1/ffmpeg5 && \
apt-get -y update && \
apt-get -y upgrade && \
apt-get install --no-install-recommends -y \
vim \
g++ \
nano \
make \
python3=~3.10 \
py3-pip \
python3.10-dev \
python3-pip \
fontconfig \
py3-setuptools && \
# Install edge ffmpeg, ensure it is properly installed
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
"ffmpeg>5.1" && \
python3-venv \
# Ensure ffmpeg is properly installed
ffmpeg && \
ffmpeg -version && \
# Install phantomjs if using x86_64, ensure it is properly installed
if [[ $(uname -m) == "x86_64" ]]; then \
cd /usr/share && \
curl -L https://github.com/Overbryd/docker-phantomjs-alpine/releases/download/2.11/phantomjs-alpine-x86_64.tar.bz2 | tar xj && \
curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar xj && \
ln -s /usr/share/phantomjs/phantomjs /usr/bin/phantomjs && \
echo "Phantom JS version:" && \
phantomjs --version && \
@ -32,12 +44,17 @@ RUN mkdir -p /config && \
# Install ytdl-sub, ensure it is installed properly
pip install --no-cache-dir ytdl_sub-*.whl && \
ytdl-sub -h && \
ldconfig && \
# Delete unneeded packages after install
rm ytdl_sub-*.whl && \
apk del \
apt-get remove -y \
g++ \
make \
py3-setuptools
python3.10-dev \
python3-venv && \
apt-get autoremove -y && \
apt-get purge -y --auto-remove && \
rm -rf /var/lib/apt/lists/*
###############################################################################
# CONTAINER CONFIGS
@ -46,7 +63,3 @@ ENV EDITOR="nano" \
HOME="/config"
VOLUME /config

View file

@ -1,2 +1,2 @@
__pypi_version__ = "2023.02.22"
__local_version__ = "2023.02.22+40d5517"
__pypi_version__ = "2023.03.15"
__local_version__ = "2023.03.15+e69933d"