Fix build and install mesa during container startup
This brings the Mesa and Vulkan installation in-line with the NVIDIA driver installation for NVIDIA GPU users.
This commit is contained in:
@@ -144,43 +144,6 @@ RUN \
|
|||||||
&& \
|
&& \
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Install mesa and vulkan requirements
|
|
||||||
# TODO: Strip this section back to only what is required for all GPU types.
|
|
||||||
# Anything only required for Intel/AMD/NVIDIA should go in the container init.
|
|
||||||
RUN \
|
|
||||||
echo "**** Update apt database ****" \
|
|
||||||
&& dpkg --add-architecture i386 \
|
|
||||||
&& echo "deb http://deb.debian.org/debian/ sid main" > /etc/apt/sources.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& \
|
|
||||||
echo "**** Install mesa requirements ****" \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
libgl1-mesa-dri \
|
|
||||||
libgl1-mesa-glx \
|
|
||||||
libgles2-mesa \
|
|
||||||
libglu1-mesa \
|
|
||||||
mesa-utils \
|
|
||||||
mesa-utils-extra \
|
|
||||||
&& \
|
|
||||||
echo "**** Install vulkan requirements ****" \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
libvulkan1 \
|
|
||||||
libvulkan1:i386 \
|
|
||||||
mesa-vulkan-drivers \
|
|
||||||
mesa-vulkan-drivers:i386 \
|
|
||||||
vulkan-tools \
|
|
||||||
&& \
|
|
||||||
echo "**** Section cleanup ****" \
|
|
||||||
&& rm -f /etc/apt/sources.list \
|
|
||||||
&& apt-get clean autoclean -y \
|
|
||||||
&& apt-get autoremove -y \
|
|
||||||
&& rm -rf \
|
|
||||||
/var/lib/apt/lists/* \
|
|
||||||
/var/tmp/* \
|
|
||||||
/tmp/* \
|
|
||||||
&& \
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Install X Server requirements
|
# Install X Server requirements
|
||||||
# TODO: Refine this list of packages to only what is required.
|
# TODO: Refine this list of packages to only what is required.
|
||||||
ENV \
|
ENV \
|
||||||
@@ -239,7 +202,7 @@ RUN \
|
|||||||
echo "**** Update apt database ****" \
|
echo "**** Update apt database ****" \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& \
|
&& \
|
||||||
echo "**** Install X Server requirements ****" \
|
echo "**** Install pulseaudio requirements ****" \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
pulseaudio \
|
pulseaudio \
|
||||||
alsa-utils \
|
alsa-utils \
|
||||||
@@ -516,11 +479,12 @@ RUN \
|
|||||||
# Install Steam
|
# Install Steam
|
||||||
RUN \
|
RUN \
|
||||||
echo "**** Update apt database ****" \
|
echo "**** Update apt database ****" \
|
||||||
|
&& dpkg --add-architecture i386 \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& \
|
&& \
|
||||||
echo "**** Install Steam ****" \
|
echo "**** Install Steam ****" \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
steam \
|
steam-installer \
|
||||||
&& ln -sf /usr/games/steam /usr/bin/steam \
|
&& ln -sf /usr/games/steam /usr/bin/steam \
|
||||||
&& \
|
&& \
|
||||||
echo "**** Section cleanup ****" \
|
echo "**** Section cleanup ****" \
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# NVIDIA Params
|
# NVIDIA Params
|
||||||
export nvidia_pci_address="$(nvidia-smi --format=csv --query-gpu=pci.bus_id --id="${gpu_select:?}" 2> /dev/null | sed -n 2p | cut -d ':' -f2,3)"
|
if [ "X${gpu_select:-}" != "X" ]; then
|
||||||
export nvidia_gpu_name=$(nvidia-smi --format=csv --query-gpu=name --id="${gpu_select:?}" 2> /dev/null | sed -n 2p)
|
export nvidia_pci_address="$(nvidia-smi --format=csv --query-gpu=pci.bus_id --id="${gpu_select:?}" 2> /dev/null | sed -n 2p | cut -d ':' -f2,3)"
|
||||||
export nvidia_host_driver_version="$(nvidia-smi 2> /dev/null | grep NVIDIA-SMI | cut -d ' ' -f3)"
|
export nvidia_gpu_name=$(nvidia-smi --format=csv --query-gpu=name --id="${gpu_select:?}" 2> /dev/null | sed -n 2p)
|
||||||
|
export nvidia_host_driver_version="$(nvidia-smi 2> /dev/null | grep NVIDIA-SMI | cut -d ' ' -f3)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Intel params
|
# Intel params
|
||||||
# This figures out if it's an intel CPU with integrated GPU
|
# This figures out if it's an intel CPU with integrated GPU
|
||||||
@@ -26,6 +28,7 @@ export intel_gpu_model="$(lspci | grep -i "VGA compatible controller: Intel" | c
|
|||||||
export amd_cpu_model="$(lscpu | grep 'Model name:' | grep -i amd | cut -d':' -f2 | xargs)"
|
export amd_cpu_model="$(lscpu | grep 'Model name:' | grep -i amd | cut -d':' -f2 | xargs)"
|
||||||
export amd_gpu_model="$(lspci | grep -i vga | grep -i amd)"
|
export amd_gpu_model="$(lspci | grep -i vga | grep -i amd)"
|
||||||
|
|
||||||
|
|
||||||
function download_driver {
|
function download_driver {
|
||||||
mkdir -p "${USER_HOME:?}/Downloads"
|
mkdir -p "${USER_HOME:?}/Downloads"
|
||||||
chown -R ${USER:?} "${USER_HOME:?}/Downloads"
|
chown -R ${USER:?} "${USER_HOME:?}/Downloads"
|
||||||
@@ -48,15 +51,6 @@ function install_nvidia_driver {
|
|||||||
# Download the driver (if it does not yet exist locally)
|
# Download the driver (if it does not yet exist locally)
|
||||||
download_driver
|
download_driver
|
||||||
|
|
||||||
# if command -v pacman &> /dev/null; then
|
|
||||||
# echo "Install NVIDIA vulkan utils" \
|
|
||||||
# && pacman -Syu --noconfirm --needed \
|
|
||||||
# lib32-nvidia-utils \
|
|
||||||
# lib32-vulkan-icd-loader
|
|
||||||
# nvidia-utils \
|
|
||||||
# vulkan-icd-loader \
|
|
||||||
# && echo
|
|
||||||
# fi
|
|
||||||
if (($(echo $nvidia_host_driver_version | cut -d '.' -f 1) > 500)); then
|
if (($(echo $nvidia_host_driver_version | cut -d '.' -f 1) > 500)); then
|
||||||
echo "Installing NVIDIA driver v${nvidia_host_driver_version:?} to match what is running on the host"
|
echo "Installing NVIDIA driver v${nvidia_host_driver_version:?} to match what is running on the host"
|
||||||
chmod +x "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
chmod +x "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run"
|
||||||
@@ -146,41 +140,52 @@ function patch_nvidia_driver {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_deb_mesa {
|
||||||
|
if [ ! -f /tmp/init-mesa-libs-install.log ]; then
|
||||||
|
echo " - Enable i386 arch"
|
||||||
|
dpkg --add-architecture i386
|
||||||
|
echo " - Add Debian SID sources"
|
||||||
|
echo "deb http://deb.debian.org/debian/ sid main" > /etc/apt/sources.list
|
||||||
|
apt-get update &>> /tmp/init-mesa-libs-install.log
|
||||||
|
echo " - Install mesa vulkan drivers"
|
||||||
|
echo "" >> /tmp/init-mesa-libs-install.log
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
libvulkan1 \
|
||||||
|
libvulkan1:i386 \
|
||||||
|
mesa-vulkan-drivers \
|
||||||
|
mesa-vulkan-drivers:i386 \
|
||||||
|
mesa-utils \
|
||||||
|
mesa-utils-extra \
|
||||||
|
vulkan-tools \
|
||||||
|
&>> /tmp/init-mesa-libs-install.log
|
||||||
|
else
|
||||||
|
echo " - Mesa has already been installed into this container"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function install_amd_gpu_driver {
|
function install_amd_gpu_driver {
|
||||||
echo "Install AMD vulkan driver"
|
echo "Install AMD Mesa driver"
|
||||||
if command -v pacman &> /dev/null; then
|
if command -v pacman &> /dev/null; then
|
||||||
pacman -Syu --noconfirm --needed \
|
pacman -Syu --noconfirm --needed \
|
||||||
lib32-vulkan-icd-loader \
|
lib32-vulkan-icd-loader \
|
||||||
lib32-vulkan-radeon \
|
lib32-vulkan-radeon \
|
||||||
vulkan-icd-loader \
|
vulkan-icd-loader \
|
||||||
vulkan-radeon
|
vulkan-radeon
|
||||||
# There is currently nothing to install inside the debian container. This already comes with the vulken drives that are required
|
elif command -v apt-get &> /dev/null; then
|
||||||
# elif command -v apt-get &> /dev/null; then
|
install_deb_mesa
|
||||||
# [[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && export APT_UPDATED=true
|
|
||||||
# apt-get install -y \
|
|
||||||
# libvulkan1 \
|
|
||||||
# libvulkan1:i386 \
|
|
||||||
# mesa-vulkan-drivers \
|
|
||||||
# mesa-vulkan-drivers:i386
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_intel_gpu_driver {
|
function install_intel_gpu_driver {
|
||||||
echo "Install Intel vulkan driver"
|
echo "Install Intel Mesa driver"
|
||||||
if command -v pacman &> /dev/null; then
|
if command -v pacman &> /dev/null; then
|
||||||
pacman -Syu --noconfirm --needed \
|
pacman -Syu --noconfirm --needed \
|
||||||
lib32-vulkan-icd-loader \
|
lib32-vulkan-icd-loader \
|
||||||
lib32-vulkan-intel \
|
lib32-vulkan-intel \
|
||||||
vulkan-icd-loader \
|
vulkan-icd-loader \
|
||||||
vulkan-intel
|
vulkan-intel
|
||||||
# There is currently nothing to install inside the debian container. This already comes with the vulken drives that are required
|
elif command -v apt-get &> /dev/null; then
|
||||||
# elif command -v apt-get &> /dev/null; then
|
install_deb_mesa
|
||||||
# [[ "${APT_UPDATED:-false}" == 'false' ]] && apt-get update && export APT_UPDATED=true
|
|
||||||
# apt-get install -y \
|
|
||||||
# libvulkan1 \
|
|
||||||
# libvulkan1:i386 \
|
|
||||||
# mesa-vulkan-drivers \
|
|
||||||
# mesa-vulkan-drivers:i386
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user