Skip to content

Instantly share code, notes, and snippets.

@tscholl2
Last active Apr 8, 2019
Embed
What would you like to do?
Dockerfile for TexStudio
docker build -t texstudio https://gist.github.com/tscholl2/a4e7d775107374422e71e43376d60cf5.git
FROM debian:stretch
# setup: language and ensure that external fonts and doc folders exists
RUN export LANG=C.UTF-8 &&\
mkdir -p /usr/share/fonts/external/ &&\
mkdir /doc/
# install utilities, texlive, ghostscript, and remove unused docs
RUN apt-get clean &&\
apt-get update &&\
apt-get autoclean -y &&\
apt-get autoremove -y &&\
apt-get update &&\
apt-get install -f -y apt-utils \
ghostscript \
make \
xzdec \
texlive-full \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-math-extra \
texlive-luatex \
texlive-pstricks \
texlive-science \
texlive-xetex &&\
apt-get purge -f -y make-doc \
texlive-fonts-extra-doc \
texlive-fonts-recommended-doc \
texlive-humanities-doc \
texlive-latex-base-doc \
texlive-latex-extra-doc \
texlive-latex-recommended-doc \
texlive-metapost-doc \
texlive-pictures-doc \
texlive-pstricks-doc \
texlive-science-doc &&\
apt-get clean &&\
apt-get autoclean -y &&\
apt-get autoremove -y --purge &&\
apt-get clean &&\
rm -rf /tmp/* /var/tmp/* &&\
rm -rf /var/lib/apt/lists/* &&\
rm -f /etc/ssh/ssh_host_*
# install texstudio pre-reqs
RUN apt-get update &&\
apt-get install -f -y xzdec \
libpoppler-qt5-1 \
libqt5concurrent5 \
libqt5core5a \
libqt5gui5 \
libqt5network5 \
libqt5printsupport5 \
libqt5script5 \
libqt5svg5 \
libqt5widgets5 \
libqt5xml5 \
wget \
default-jre &&\
apt-get clean &&\
apt-get autoclean -y &&\
apt-get autoremove -y --purge &&\
apt-get clean &&\
rm -rf /tmp/* /var/tmp/* &&\
rm -rf /var/lib/apt/lists/* &&\
rm -f /etc/ssh/ssh_host_*
# install texstudio
RUN wget -O texstudio.deb https://download.opensuse.org/repositories/home:/jsundermeyer/Debian_9.0/amd64/texstudio_2.12.10-1+1.1_amd64.deb &&\
dpkg -i texstudio.deb &&\
rm texstudio.deb
# install language tool server
RUN wget -O lt.zip https://languagetool.org/download/LanguageTool-3.8.zip &&\
mkdir -p /home/user/languagetool &&\
unzip -d /home/user/languagetool lt.zip &&\
rm lt.zip
# make a new unprivileged user to use stuff
# the 1001 maps to the uid/gid of the user
# on the actual machine, if the docker user
# is the same, there are no terrible permission
# issues when editing files in either docker
# or locally.
RUN useradd -u 1001 user &&\
mkdir -p /home/user/texmf &&\
chown -R 1001:1001 /home/user
USER user
WORKDIR /home/user
# this is required to install new tex packages
RUN tlmgr init-usertree &&\
tlmgr update --all
# example of how to install new packages
RUN tlmgr install units logreq biblatex
CMD ["/usr/bin/texstudio"]
xhost + && docker run \
--cap-drop=all \
-it \
--rm \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/stuff:/home/user/Documents \
-v $HOME/.config/texstudio:/home/user/.config/texstudio \
-e DISPLAY=unix$DISPLAY \
--memory=2g \
--cpus=2 \
--name texstudio \
texstudio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment