diff --git a/Dockerfile b/Dockerfile index c1efbff..c3696ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -184,8 +184,8 @@ RUN dpkg --add-architecture i386 && \ }\n\ }" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json # Expose NVIDIA libraries and paths -ENV PATH /usr/local/nvidia/bin:${PATH} -ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 +ENV PATH /usr/local/nvidia/bin${PATH:+:${PATH}} +ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/nvidia/lib:/usr/local/nvidia/lib64 # Make all NVIDIA GPUs visible by default ENV NVIDIA_VISIBLE_DEVICES all # All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work @@ -210,7 +210,6 @@ ENV WEBRTC_ENABLE_RESIZE false ENV ENABLE_BASIC_AUTH true # Set versions for components that should be manually checked before upgrading, other component versions are automatically determined by fetching the version online -ARG VIRTUALGL_VERSION=3.1.1 ARG NOVNC_VERSION=1.4.0 # Install Xvfb @@ -219,13 +218,21 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ rm -rf /var/lib/apt/lists/* # Install VirtualGL and make libraries available for preload -RUN curl -fsSL -O "https://github.com/VirtualGL/virtualgl/releases/download/${VIRTUALGL_VERSION}/virtualgl_${VIRTUALGL_VERSION}_amd64.deb" && \ +RUN VIRTUALGL_VERSION="$(curl -fsSL "https://api.github.com/repos/VirtualGL/virtualgl/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')" && \ + if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ + dpkg --add-architecture i386 && \ + curl -fsSL -O "https://github.com/VirtualGL/virtualgl/releases/download/${VIRTUALGL_VERSION}/virtualgl_${VIRTUALGL_VERSION}_amd64.deb" && \ curl -fsSL -O "https://github.com/VirtualGL/virtualgl/releases/download/${VIRTUALGL_VERSION}/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb" && \ apt-get update && apt-get install -y --no-install-recommends ./virtualgl_${VIRTUALGL_VERSION}_amd64.deb ./virtualgl32_${VIRTUALGL_VERSION}_amd64.deb && \ rm -f "virtualgl_${VIRTUALGL_VERSION}_amd64.deb" "virtualgl32_${VIRTUALGL_VERSION}_amd64.deb" && \ chmod u+s /usr/lib/libvglfaker.so /usr/lib/libvglfaker-nodl.so /usr/lib/libvglfaker-opencl.so /usr/lib/libdlfaker.so /usr/lib/libgefaker.so && \ chmod u+s /usr/lib32/libvglfaker.so /usr/lib32/libvglfaker-nodl.so /usr/lib32/libvglfaker-opencl.so /usr/lib32/libdlfaker.so /usr/lib32/libgefaker.so && \ - chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so /usr/lib/i386-linux-gnu/libvglfaker-nodl.so /usr/lib/i386-linux-gnu/libvglfaker-opencl.so /usr/lib/i386-linux-gnu/libdlfaker.so /usr/lib/i386-linux-gnu/libgefaker.so && \ + chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so /usr/lib/i386-linux-gnu/libvglfaker-nodl.so /usr/lib/i386-linux-gnu/libvglfaker-opencl.so /usr/lib/i386-linux-gnu/libdlfaker.so /usr/lib/i386-linux-gnu/libgefaker.so; \ + elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \ + curl -fsSL -O "https://github.com/VirtualGL/virtualgl/releases/download/${VIRTUALGL_VERSION}/virtualgl_${VIRTUALGL_VERSION}_arm64.deb" && \ + apt-get update && apt-get install -y --no-install-recommends ./virtualgl_${VIRTUALGL_VERSION}_arm64.deb && \ + rm -f "virtualgl_${VIRTUALGL_VERSION}_arm64.deb" && \ + chmod u+s /usr/lib/libvglfaker.so /usr/lib/libvglfaker-nodl.so /usr/lib/libdlfaker.so /usr/lib/libgefaker.so; fi && \ rm -rf /var/lib/apt/lists/* # Anything below this line should always be kept the same between docker-nvidia-glx-desktop and docker-nvidia-egl-desktop diff --git a/entrypoint.sh b/entrypoint.sh index c33d7cc..4a214c4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,10 +18,10 @@ echo "user:$PASSWD" | sudo chpasswd sudo rm -rf /tmp/.X* ~/.cache # Change time zone from environment variable sudo ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" | sudo tee /etc/timezone > /dev/null -# Add Lutris and VirtualGL directories to path -export PATH="${PATH}:/usr/local/games:/usr/games" +# Add Lutris directories to path +export PATH="${PATH:+${PATH}:}/usr/local/games:/usr/games" # Add LibreOffice to library path -export LD_LIBRARY_PATH="/usr/lib/libreoffice/program:${LD_LIBRARY_PATH}" +export LD_LIBRARY_PATH="/usr/lib/libreoffice/program${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" # Start DBus without systemd sudo /etc/init.d/dbus start @@ -48,7 +48,7 @@ fi # Use VirtualGL to run the KDE desktop environment with OpenGL if the GPU is available, otherwise use OpenGL with llvmpipe if [ -n "$(nvidia-smi --query-gpu=uuid --format=csv | sed -n 2p)" ]; then - export VGL_REFRESHRATE="$REFRESH" + export VGL_REFRESHRATE="${REFRESH}" /usr/bin/vglrun -d "${VGL_DISPLAY:-egl}" +wm /usr/bin/dbus-launch /usr/bin/startplasma-x11 & else /usr/bin/dbus-launch /usr/bin/startplasma-x11 & diff --git a/selkies-gstreamer-entrypoint.sh b/selkies-gstreamer-entrypoint.sh index 5c889e7..cfa3b74 100755 --- a/selkies-gstreamer-entrypoint.sh +++ b/selkies-gstreamer-entrypoint.sh @@ -8,7 +8,7 @@ . /opt/gstreamer/gst-env # Set default display -export DISPLAY="${DISPLAY:-\:0}" +export DISPLAY="${DISPLAY:-:0}" # Configure joystick interposer sudo mkdir -pm755 /dev/input @@ -17,7 +17,7 @@ sudo touch /dev/input/{js0,js1,js2,js3} # Show debug logs for GStreamer export GST_DEBUG="${GST_DEBUG:-*:2}" # Set password for basic authentication -if [ "${ENABLE_BASIC_AUTH,,}" = "true" ] && [ -z "$BASIC_AUTH_PASSWORD" ]; then export BASIC_AUTH_PASSWORD="$PASSWD"; fi +if [ "${ENABLE_BASIC_AUTH,,}" = "true" ] && [ -z "${BASIC_AUTH_PASSWORD}" ]; then export BASIC_AUTH_PASSWORD="${PASSWD}"; fi # Wait for X11 to start echo "Waiting for X socket"