From 6e4581c7cbc75a569dc13449def50743483ea2a2 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 22 Sep 2018 23:19:06 +0300 Subject: [PATCH] Updates. - Use newer runas script, using gosu instead of sudo. - Added test steps to the build using the example presentation (in fact using Docker Hub as a sort of CI). - Use newer Golang image. - Small corrections to README. - More streamlined Makefile. - Added groff to image. - Added XeTex to image. --- .dockerignore | 2 ++ Dockerfile | 17 ++++++++++++----- README.md | 6 ++++-- example/Makefile | 8 +++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index 72e8ffc..27e61cc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,3 @@ * +!example/ +example/.gitignore diff --git a/Dockerfile b/Dockerfile index 206eea3..a1b9512 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,19 @@ -FROM golang:1.9-alpine as on-change +FROM golang:1.11-alpine3.8 as on-change RUN apk --update add git && \ rm -rf /var/cache/apk/* && \ /usr/local/go/bin/go get github.com/spelufo/on-change FROM debian:stretch-slim COPY --from=on-change /go/bin/on-change /usr/local/bin -RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ +RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + fonts-font-awesome \ + gosu \ graphviz \ + groff \ lmodern \ make \ pandoc \ - sudo \ texlive-extra-utils \ texlive-fonts-extra \ texlive-fonts-recommended \ @@ -19,11 +21,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ texlive-latex-base \ texlive-latex-extra \ texlive-luatex \ - texlive-publishers && \ + texlive-publishers \ + texlive-xetex \ + && \ rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/* ADD [ "https://www.shore.co.il/blog/static/runas", "/entrypoint" ] ENTRYPOINT [ "/bin/sh", "/entrypoint" ] +CMD [ "on-change", ".", "make" ] VOLUME /volume WORKDIR /volume ENV HOME /volume -CMD [ "on-change", ".", "make" ] +# Run a test build. +COPY example/ /example/ +RUN make -C /example all clean diff --git a/README.md b/README.md index 26c6b5c..d2b4a38 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ Markdown or DOT). ## Usage -`docker run -itv "$PWD:/project" adarnimrod/presentation` +`docker run --rm -itv "$PWD:/volume" adarnimrod/presentation` Will watch the current directory and run `make` whenever a file changes. One can -add a shell alias `alias presentation='docker run -itv "$PWD:/volume" +add a shell alias `alias presentation='docker run --rm -itv "$PWD:/volume" adarnimrod/presentation'` for easier use. See the example folder for more details. @@ -20,7 +20,9 @@ See the example folder for more details. - [GNU Make](https://www.gnu.org/software/make/) - [LuaTex](http://luatex.org/) - [LaTeX](http://www.latex-project.org/) +- [XeTex](http://xetex.sourceforge.net/) - [on-change](https://github.com/spelufo/on-change) +- [groff](https://www.gnu.org/software/groff/) ## License diff --git a/example/Makefile b/example/Makefile index f8d561f..c8badc1 100644 --- a/example/Makefile +++ b/example/Makefile @@ -3,10 +3,12 @@ all: presentation.pdf presentation.pdf: diagram.pdf - pandoc -t beamer presentation.md -o presentation.pdf -diagram.pdf: diagram.dot - dot diagram.dot -Tpdf > diagram.pdf +%.pdf: %.md + pandoc -t beamer $< -o $@ + +%.pdf: %.dot + dot $< -Tpdf > $@ clean: - rm *.pdf -- GitLab