From 4f495affbc9e080be551fadd47fc4916ab71c0df Mon Sep 17 00:00:00 2001 From: Clemens Klug Date: Mon, 29 Apr 2019 16:30:06 +0200 Subject: [PATCH 1/3] add docker (Debian buster) --- Dockerfile | 8 ++++++++ docker-compose.yml | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de2e695 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM debian:buster + +RUN apt update && apt install -y nodejs npm +ADD . /latex +WORKDIR /latex +RUN npm install + +CMD ["npm", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0ddd8dd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3" +services: + latesch: + build: . + image: docker.wiai.de/latex/build:0.1 + ports: + - "127.0.0.1:8000:8000" +# networks: +# - traefik_net +# labels: +# - "traefik.enable=true" +# - "traefik.port=8000" +# - "traefik.docker.network=traefik_net" +# - "traefik.http.frontend.rule=Host:latesch.elli-valley.de" +# +#networks: +# traefik_net: +# external: +# name: traefik_net \ No newline at end of file -- 2.47.2 From 5b1927a6ac74ad0bc3b6b5ffb938a9b2c8b5708a Mon Sep 17 00:00:00 2001 From: Clemens Klug Date: Mon, 29 Apr 2019 16:35:12 +0200 Subject: [PATCH 2/3] save 500 mb by using alpine --- Dockerfile | 7 +++++-- docker-compose.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index de2e695..104ddf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ -FROM debian:buster +#FROM debian:buster +#RUN apt update && apt install -y nodejs npm + +FROM alpine:3.9 +RUN apk add --update --no-cache npm -RUN apt update && apt install -y nodejs npm ADD . /latex WORKDIR /latex RUN npm install diff --git a/docker-compose.yml b/docker-compose.yml index 0ddd8dd..388ce27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3" services: latesch: build: . - image: docker.wiai.de/latex/build:0.1 + image: docker.wiai.de/latex/build:0.1-alpine ports: - "127.0.0.1:8000:8000" # networks: -- 2.47.2 From a603a9531b8427b0c7daf43202044fbba926fe1e Mon Sep 17 00:00:00 2001 From: Clemens Klug Date: Mon, 6 May 2019 18:09:54 +0200 Subject: [PATCH 3/3] update docker --- Dockerfile | 20 ++++++++++++++------ docker-compose.yml | 4 +++- tex2svg.sh | 11 +++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100755 tex2svg.sh 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; -- 2.47.2