From dc77fa823f0e22251428ea45e82e1eeda0dbae49 Mon Sep 17 00:00:00 2001 From: ZebRawnsley Date: Wed, 15 Mar 2023 11:38:39 +1300 Subject: [PATCH] add nvidia gpu support change base image from alpine to ubuntu, install ffmpeg5 from ppa and add required deps for nvidia --- Makefile | 2 +- docker/Dockerfile | 49 +++++++++++++++++++++++++--------------- src/ytdl_sub/__init__.py | 4 ++-- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 1242f47e..6b21416b 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/docker/Dockerfile b/docker/Dockerfile index c80f584f..2364876f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 @@ -45,8 +62,4 @@ RUN mkdir -p /config && \ ENV EDITOR="nano" \ HOME="/config" -VOLUME /config - - - - +VOLUME /config \ No newline at end of file diff --git a/src/ytdl_sub/__init__.py b/src/ytdl_sub/__init__.py index 38c8858f..2bf1fbf3 100644 --- a/src/ytdl_sub/__init__.py +++ b/src/ytdl_sub/__init__.py @@ -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"