multistage: seperate latex step, sane image size again

This commit is contained in:
Clemens Klug 2019-05-10 11:23:23 +02:00
parent a603a9531b
commit 13fb36746a
3 changed files with 14 additions and 13 deletions

View File

@ -1,19 +1,22 @@
FROM alpine:3.9
RUN apk add --update --no-cache npm texlive poppler cairo bash texmf-dist-full ghostscript
FROM alpine:3.9 as latesch
RUN apk add --update --no-cache 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 && \
cd /tmp && \
RUN 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 / && \
cd /latex && \
rm -rf /tmp/pdf2svg-0.2.3/ && \
echo "cd /latex" > /start.sh && \
echo "bash tex2svg.sh" > /start.sh && \
echo "npm start" >> /start.sh
bash tex2svg.sh
CMD ["bash", "/start.sh"]
FROM alpine:3.9
EXPOSE 8000
WORKDIR /latex
COPY --from=latesch /latex .
RUN apk add --update --no-cache npm && npm install
CMD ["npm", "start"]

View File

@ -2,9 +2,7 @@ version: "3"
services:
latesch:
build: .
image: docker.wiai.de/latex/build:0.4-alpine
# volumes:
# - ./:/latex
image: docker.wiai.de/latex/serve:0.5-alpine
ports:
- "127.0.0.1:8000:8000"
# networks:

View File

@ -6,6 +6,6 @@ for file in sections/german/*/*.tex; do
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
rm -f $base.aux $base.log $base.toc $base.out $base.pdf $base-crop.pdf
popd
done;