-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from vajonam/feature/virtualgl-support
Add virutalgl for hardware acceleration.
- Loading branch information
Showing
9 changed files
with
144 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
# Get and install Easy noVNC. | ||
FROM golang:1.14-buster AS easy-novnc-build | ||
WORKDIR /src | ||
RUN go mod init build && \ | ||
go get github.com/geek1011/[email protected] && \ | ||
go build -o /bin/easy-novnc github.com/geek1011/easy-novnc | ||
# ORIGINAL REPO https://github.com/damanikjosh/virtualgl-turbovnc-docker/blob/main/Dockerfile | ||
ARG UBUNTU_VERSION=22.04 | ||
|
||
# Get TigerVNC and Supervisor for isolating the container. | ||
FROM debian:buster | ||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends openbox tigervnc-standalone-server supervisor gosu && \ | ||
rm -rf /var/lib/apt/lists && \ | ||
mkdir -p /usr/share/desktop-directories | ||
FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu${UBUNTU_VERSION} | ||
LABEL authors="vajonam, Michael Helfrich - helfrichmichael" | ||
|
||
# Get all of the remaining dependencies for the OS, VNC, and Prusaslicer. | ||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends lxterminal nano wget openssh-client rsync ca-certificates xdg-utils htop tar xzip gzip bzip2 zip unzip && \ | ||
rm -rf /var/lib/apt/lists | ||
ARG VIRTUALGL_VERSION=3.1.1-20240228 | ||
ARG TURBOVNC_VERSION=3.1.1-20240127 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt update && apt install -y --no-install-recommends --allow-unauthenticated \ | ||
lxde gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \ | ||
freeglut3 libgtk2.0-dev libwxgtk3.0-gtk3-dev libwx-perl libxmu-dev libgl1-mesa-glx libgl1-mesa-dri \ | ||
xdg-utils locales locales-all pcmanfm jq curl git firefox-esr \ | ||
RUN | ||
# Install some basic dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
wget xorg xauth gosu supervisor x11-xserver-utils libegl1-mesa libgl1-mesa-glx \ | ||
locales-all libpam0g libxt6 libxext6 dbus-x11 xauth x11-xkb-utils xkb-data python3 xterm novnc \ | ||
lxde gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \ | ||
freeglut3 libgtk2.0-dev libwxgtk3.0-gtk3-dev libwx-perl libxmu-dev libgl1-mesa-glx libgl1-mesa-dri \ | ||
xdg-utils locales locales-all pcmanfm jq curl git bzip2 gpg-agent software-properties-common \ | ||
&& mkdir -p /usr/share/desktop-directories \ | ||
# Install Firefox without Snap. | ||
&& add-apt-repository ppa:mozillateam/ppa \ | ||
&& apt update \ | ||
&& apt install -y firefox-esr --no-install-recommends \ | ||
# Clean everything up. | ||
&& apt autoclean -y \ | ||
&& apt autoremove -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Prusaslicer | ||
# Many of the commands below were derived and pulled from previous work by dmagyar on GitHub. | ||
# Here's their Dockerfile for reference https://github.com/dmagyar/prusaslicer-vnc-docker/blob/main/Dockerfile.amd64 | ||
# Install virtualgl and turbovnc | ||
RUN wget -qO /tmp/virtualgl_${VIRTUALGL_VERSION}_amd64.deb https://packagecloud.io/dcommander/virtualgl/packages/any/any/virtualgl_${VIRTUALGL_VERSION}_amd64.deb/download.deb?distro_version_id=35\ | ||
&& wget -qO /tmp/turbovnc_${TURBOVNC_VERSION}_amd64.deb https://packagecloud.io/dcommander/turbovnc/packages/any/any/turbovnc_${TURBOVNC_VERSION}_amd64.deb/download.deb?distro_version_id=35 \ | ||
&& dpkg -i /tmp/virtualgl_${VIRTUALGL_VERSION}_amd64.deb \ | ||
&& dpkg -i /tmp/turbovnc_${TURBOVNC_VERSION}_amd64.deb \ | ||
&& rm -rf /tmp/*.deb | ||
|
||
# Install prusaslicer | ||
WORKDIR /slic3r | ||
ADD get_latest_prusaslicer_release.sh /slic3r | ||
|
||
RUN chmod +x /slic3r/get_latest_prusaslicer_release.sh \ | ||
&& latestSlic3r=$(/slic3r/get_latest_prusaslicer_release.sh url) \ | ||
&& slic3rReleaseName=$(/slic3r/get_latest_prusaslicer_release.sh name) \ | ||
|
@@ -52,23 +57,26 @@ RUN chmod +x /slic3r/get_latest_prusaslicer_release.sh \ | |
&& mkdir -p /configs/.config/ \ | ||
&& ln -s /configs/.config/ /home/slic3r/ \ | ||
&& mkdir -p /home/slic3r/.config/ \ | ||
# We can now set the Download directory for Firefox and other browsers. | ||
# We can also add /prints/ to the file explorer bookmarks for easy access. | ||
&& echo "XDG_DOWNLOAD_DIR=\"/prints/\"" >> /home/slic3r/.config/user-dirs.dirs \ | ||
&& echo "file:///prints prints" >> /home/slic3r/.gtk-bookmarks | ||
&& echo "file:///prints prints" >> /home/slic3r/.gtk-bookmarks | ||
|
||
# Generate key for novnc and cleanup erros | ||
RUN openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/novnc.pem -out /etc/novnc.pem -days 365 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" \ | ||
&& rm /etc/xdg/autostart/lxpolkit.desktop \ | ||
&& mv /usr/bin/lxpolkit /usr/bin/lxpolkit.ORIG | ||
|
||
ENV PATH ${PATH}:/opt/VirtualGL/bin:/opt/TurboVNC/bin | ||
|
||
COPY --from=easy-novnc-build /bin/easy-novnc /usr/local/bin/ | ||
COPY menu.xml /etc/xdg/openbox/ | ||
COPY supervisord.conf /etc/ | ||
ADD entrypoint.sh /entrypoint.sh | ||
ADD supervisord.conf /etc/ | ||
|
||
# HTTP Port | ||
EXPOSE 8080 | ||
# Add a default file to resize, etc for noVNC. | ||
ADD vncresize.html /usr/share/novnc/index.html | ||
|
||
# VNC Port | ||
EXPOSE 5900 | ||
#Set firefox to run with hardware accel as if enabled. | ||
RUN sed -i 's|exec $MOZ_LIBDIR/$MOZ_APP_NAME "$@"|if [ -n "$ENABLEHWGPU" ] \&\& [ "$ENABLEHWGPU" = "true" ]; then\n exec /usr/bin/vglrun $MOZ_LIBDIR/$MOZ_APP_NAME "$@"\nelse\n exec $MOZ_LIBDIR/$MOZ_APP_NAME "$@"\nfi|g' /usr/bin/firefox-esr | ||
|
||
VOLUME /configs/ | ||
VOLUME /prints/ | ||
|
||
# It's time! Let's get to work! We use /configs/ as a bindable volume for Prusaslicers configurations. We use /prints/ to provide a location for STLs and GCODE files. | ||
CMD ["bash", "-c", "chown -R slic3r:slic3r /home/slic3r/ /configs/ /prints/ /dev/stdout && exec gosu slic3r supervisord"] | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -e | ||
rm -f /tmp/.X*-lock | ||
rm -f /tmp/.X11-unix/X* | ||
export DISPLAY=${DISPLAY:-:0} | ||
DISPLAY_NUMBER=$(echo $DISPLAY | cut -d: -f2) | ||
export NOVNC_PORT=${NOVNC_PORT:-8080} | ||
export VNC_PORT=${VNC_PORT:-5900} | ||
export VNC_RESOLUTION=${VNC_RESOLUTION:-1280x800} | ||
if [ -n "$VNC_PASSWORD" ]; then | ||
mkdir -p /root/.vnc | ||
echo "$VNC_PASSWORD" | vncpasswd -f > /root/.vnc/passwd | ||
chmod 0600 /root/.vnc/passwd | ||
export VNC_SEC= | ||
else | ||
export VNC_SEC="-securitytypes TLSNone,X509None,None" | ||
fi | ||
export LOCALFBPORT=$((${VNC_PORT} + DISPLAY_NUMBER)) | ||
if [ -n "$ENABLEHWGPU" ] && [ "$ENABLEHWGPU" = "true" ]; then | ||
export VGLRUN="/usr/bin/vglrun" | ||
else | ||
export VGLRUN= | ||
fi | ||
|
||
export SUPD_LOGLEVEL="${SUPD_LOGLEVEL:-TRACE}" | ||
export VGL_DISPLAY="${VGL_DISPLAY:-egl}" | ||
|
||
# fix perms and launch supervisor with the above environment variables | ||
chown -R slic3r:slic3r /home/slic3r/ /configs/ /prints/ /dev/stdout && exec gosu slic3r supervisord -e $SUPD_LOGLEVEL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
<script> | ||
window.location.replace("./vnc.html?autoconnect=true&resize=remote&reconnect=true&show_dot=true"); | ||
</script> | ||
</head> | ||
</html> |