Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 20 additions & 35 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.9
FROM alpine as build

# tinytex dependencies
RUN apk --no-cache add \
Expand All @@ -11,13 +11,10 @@ RUN apk --no-cache add \
lua \
gcc

# add user
# add user install as appuser and setup workdir
RUN addgroup -S appgroup && adduser -S appuser -G appgroup

# install as appuser
USER appuser

# setup workdir
WORKDIR /home/appuser

# setup path
Expand All @@ -29,11 +26,8 @@ RUN wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh
# add tlmgr to path
RUN /home/appuser/.TinyTeX/bin/*/tlmgr path add

# verify latex version
RUN latex --version

# verify tlmgr version
RUN tlmgr --version
# verify latex and tlmgr version
RUN latex --version && tlmgr --version

# install texlive packages
RUN tlmgr install \
Expand All @@ -44,44 +38,35 @@ RUN tlmgr install \
# verify
RUN dvisvgm --version

# setup test
RUN mkdir /tmp/test
FROM alpine as production

# test workdir
WORKDIR /tmp/test
RUN apk --no-cache add perl

# copy test latex standalone equation
COPY ./test.tex .
# add user install as appuser and setup workdir
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
WORKDIR /home/appuser

# temp assign root to clean up tlmgr only dependencies
USER root
COPY --from=build /home/appuser/.TinyTeX /home/appuser/.TinyTeX

# remove dependencies
RUN apk del wget xz tar
ENV PATH=/home/appuser/.TinyTeX/bin/x86_64-linuxmusl:$PATH

# reset user
USER appuser
# setup test workdir
RUN mkdir /tmp/test
WORKDIR /tmp/test
# copy test latex standalone equation
COPY ./test.tex .

# run latex - ignore latex errors
RUN latex -interaction=nonstopmode ./test.tex || true

# run dvisvgm with no-fonts
RUN dvisvgm --no-fonts ./test.dvi

# verify no-font svg was generated
RUN test -f test.svg

# remove no-font svg
RUN rm test.svg

# run dvisvgm with ttf font
RUN dvisvgm --font-format=ttf ./test.dvi

# verify ttf font svg was generated
RUN test -f test.svg

# clean up tests
RUN rm -R /tmp/*
RUN dvisvgm --no-fonts ./test.dvi && test -f test.svg \
&& rm test.svg && dvisvgm --font-format=ttf ./test.dvi \
&& test -f test.svg && rm -R /tmp/*

# reset workdir
WORKDIR /home/appuser