2022-02-01 03:34:19 +00:00
# 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/easy-novnc@v1.1.0 && \
go build -o /bin/easy-novnc github.com/geek1011/easy-novnc
# 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
2022-02-08 01:21:28 +00:00
# Get all of the remaining dependencies for the OS, VNC, and Prusaslicer.
2022-02-01 03:34:19 +00:00
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
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 \
2022-02-08 01:21:28 +00:00
freeglut3 libgtk2.0-dev libwxgtk3.0-gtk3-dev libwx-perl libxmu-dev libgl1-mesa-glx libgl1-mesa-dri \
2022-02-14 04:06:36 +00:00
xdg-utils locales locales-all pcmanfm jq curl git firefox-esr \
2022-02-01 03:34:19 +00:00
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*
2022-02-08 01:21:28 +00:00
# Install Prusaslicer
2022-02-01 03:34:19 +00:00
# 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
WORKDIR /slic3r
2022-02-04 23:54:16 +00:00
ADD get_latest_prusaslicer_release.sh /slic3r
2022-02-01 03:34:19 +00:00
2022-02-08 01:21:28 +00:00
RUN chmod +x /slic3r/get_latest_prusaslicer_release.sh \
2022-02-04 23:54:16 +00:00
&& latestSlic3r = $( /slic3r/get_latest_prusaslicer_release.sh url) \
&& slic3rReleaseName = $( /slic3r/get_latest_prusaslicer_release.sh name) \
2022-02-01 03:34:19 +00:00
&& curl -sSL ${ latestSlic3r } > ${ slic3rReleaseName } \
&& rm -f /slic3r/releaseInfo.json \
&& mkdir -p /slic3r/slic3r-dist \
&& tar -xjf ${ slic3rReleaseName } -C /slic3r/slic3r-dist --strip-components 1 \
&& rm -f /slic3r/${ slic3rReleaseName } \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoclean \
&& groupadd slic3r \
2022-02-02 02:50:33 +00:00
&& useradd -g slic3r --create-home --home-dir /home/slic3r slic3r \
2022-02-01 03:34:19 +00:00
&& mkdir -p /slic3r \
2022-02-02 02:50:33 +00:00
&& mkdir -p /configs \
2022-02-14 04:06:36 +00:00
&& mkdir -p /prints/ \
&& chown -R slic3r:slic3r /slic3r/ /home/slic3r/ /prints/ /configs/ \
2022-02-01 03:34:19 +00:00
&& locale-gen en_US \
2022-02-02 02:50:33 +00:00
&& mkdir /configs/.local \
2022-02-03 00:12:15 +00:00
&& mkdir -p /configs/.config/ \
2022-02-14 04:06:36 +00:00
&& 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
2022-02-01 03:34:19 +00:00
COPY --from= easy-novnc-build /bin/easy-novnc /usr/local/bin/
COPY menu.xml /etc/xdg/openbox/
COPY supervisord.conf /etc/
2023-07-01 03:54:28 +00:00
# HTTP Port
2022-02-01 03:34:19 +00:00
EXPOSE 8080
2023-07-01 03:54:28 +00:00
# VNC Port
EXPOSE 5900
2022-02-02 02:50:33 +00:00
VOLUME /configs/
2022-02-14 04:06:36 +00:00
VOLUME /prints/
2022-02-01 03:34:19 +00:00
2022-02-14 04:06:36 +00:00
# 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" ]