diff --git a/Dockerfile b/Dockerfile index 104ddf5..5b7714b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,19 @@ -#FROM debian:buster -#RUN apt update && apt install -y nodejs npm - FROM alpine:3.9 -RUN apk add --update --no-cache npm +RUN apk add --update --no-cache npm texlive poppler cairo bash texmf-dist-full ghostscript +RUN apk add --update --no-cache --virtual .build-deps poppler-dev cairo-dev wget build-base pkgconf ADD . /latex WORKDIR /latex -RUN npm install +RUN npm install && \ + cd /tmp && \ + wget https://github.com/dawbarton/pdf2svg/archive/v0.2.3.tar.gz && \ + tar -xzf v0.2.3.tar.gz && \ + cd pdf2svg-0.2.3/ && \ + ./configure && make && make install && \ + cd / && \ + rm -rf /tmp/pdf2svg-0.2.3/ && \ + echo "cd /latex" > /start.sh && \ + echo "bash tex2svg.sh" > /start.sh && \ + echo "npm start" >> /start.sh -CMD ["npm", "start"] \ No newline at end of file +CMD ["bash", "/start.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 388ce27..b698e95 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,9 @@ version: "3" services: latesch: build: . - image: docker.wiai.de/latex/build:0.1-alpine + image: docker.wiai.de/latex/build:0.4-alpine +# volumes: +# - ./:/latex ports: - "127.0.0.1:8000:8000" # networks: diff --git a/tex2svg.sh b/tex2svg.sh new file mode 100755 index 0000000..ba694f0 --- /dev/null +++ b/tex2svg.sh @@ -0,0 +1,11 @@ +#!/bin/bash +for file in sections/german/*/*.tex; do + pushd $(dirname $file) + base=$(basename ${file%.tex}) + pdflatex $base + pdfcrop $base.pdf + pdf2svg $base.pdf $base-orig.svg + pdf2svg $base-crop.pdf $base-crop.svg + rm -f $base.aux $base.log $base.out $base.pdf $base-crop.pdf + popd +done;