-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVgl-Egl-Xvfb.def
104 lines (86 loc) · 3 KB
/
Vgl-Egl-Xvfb.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Bootstrap: docker
From: nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04
%post -c /bin/bash
# Enable error handling
set -euxo pipefail
# Set DEBIAN_FRONTEND to noninteractive for package installation
export DEBIAN_FRONTEND=noninteractive
# Update apt-get and install necessary packages
apt-get update && apt-get install --no-install-recommends -y \
software-properties-common \
jq \
curl \
terminator \
tmux \
vim \
libsm6 \
libxext6 \
libxrender-dev \
gedit \
git \
python3-venv \
python3-dev \
python3-pip \
openssh-client \
unzip \
htop \
libopenni-dev \
apt-utils \
usbutils \
dialog \
ffmpeg \
nvidia-settings \
libffi-dev \
flex \
bison \
build-essential \
wget \
pciutils \
mesa-utils \
xauth \
xvfb \
x11vnc
apt-get remove -y python3-blinker
# Download the Miniforge installer for the architecture
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
# Run the installer in silent mode (no user prompts)
bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opt/miniforge
# Clean up installer to save space
rm Miniforge3-$(uname)-$(uname -m).sh
# Install mamba (you could also install other packages you need here)
/opt/miniforge/bin/conda install -n base -c conda-forge mamba -y
# Install VirtualGL for GPU-accelerated remote desktop applications
VIRTUALGL_VERSION=$(curl -fsSL "https://api.github.com/repos/VirtualGL/virtualgl/releases/67016359" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g') && \
curl -fsSL -O https://sourceforge.net/projects/virtualgl/files/virtualgl_${VIRTUALGL_VERSION}_amd64.deb && \
apt-get update && apt-get install -y --no-install-recommends ./virtualgl_${VIRTUALGL_VERSION}_amd64.deb && \
rm virtualgl_${VIRTUALGL_VERSION}_amd64.deb && \
rm -rf /var/lib/apt/lists/* && \
chmod u+s /usr/lib/libvglfaker.so && \
chmod u+s /usr/lib/libdlfaker.so && \
# Clean up unnecessary files after installation
apt-get clean
rm -rf /var/lib/apt/lists/*
# Update pip
pip install --upgrade pip
%files
# Copy the 10_nvidia.json file into the container
10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json
%environment
# Set environment variables for the runtime
export PATH=/opt/miniforge/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
export PULSE_SERVER=none
export LIBGL_ALWAYS_INDIRECT=1
export VGL_DISPLAY=egl
export VGL_REFRESHRATE=60
export DISPLAY=:0 # Set DISPLAY variable for Xvfb
export PYTHONUNBUFFERED=1
%runscript
# Ensure DISPLAY variable is set
export DISPLAY=:0
# Execute the provided command or default to bash
if [ "$#" -eq 0 ]; then
exec /bin/bash
else
exec "$@"
fi