FROM alpine:latest
MAINTAINER luki42

ENV PATH=/usr/local/texlive/bin/x86_64-linuxmusl:$PATH

COPY ./texlive-profile.txt /tmp/

RUN apk add --no-cache perl wget xz texlive && \
    \
    # Install texlive
    echo "downloading tlmgr" && \
    wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
    mkdir /tmp/install-tl && \
    tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
    /tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt && \
    \
    # Clean up
    rm -rf /tmp/* \
           /var/tmp/* \
    apk del wget xz texlive

# Expose /home as workin dir
WORKDIR /home
VOLUME ["/home"]
