From 45a609764e9db782b60df7427b20bfde1e31e5c7 Mon Sep 17 00:00:00 2001 From: Anuj Koli Date: Mon, 13 Dec 2021 18:26:41 -0500 Subject: [PATCH] Added ecxample for pdf build using pandoc --- Dockerfile | 15 +++++++-------- docker-compose.yml | 2 +- entrypoint.sh | 13 +++++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 71422bf..640c5f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,12 +7,11 @@ RUN apt-get update && \ chown node:node /build && chmod 0750 /build # Install custom gitbook version -RUN npm i gitbook-cli -g - -USER node - -RUN git clone -b fix/filename-regex https://github.com/PauloASilva/gitbook.git ~/gitbook-custom && \ - cd ~/gitbook-custom && npm i && \ - gitbook alias ~/gitbook-custom latest - + WORKDIR /build +USER root +ENV PUPPETEER_SKIP_DOWNLOAD=true +RUN apt-get install -y pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra +COPY entrypoint.sh . +# RUN git clone "https://github.com/simonhaenisch/md-to-pdf" && cd md-to-pdf && npm link + diff --git a/docker-compose.yml b/docker-compose.yml index ec4971e..190fe15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: build: build: . image: dockersecbuilder:latest - entrypoint: gitbook pdf ./ ./dist/owasp-docker-security.pdf --gitbook=latest + entrypoint: /build/entrypoint.sh volumes: - .:/build diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..d40f978 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash +VAR="" + +for f in *.md; do + [[ -f $f ]] || continue + VAR+="'${f}' " + cat "$f" >> './dist/combined-guide.md' +done + +IFS=$'\n' +echo "Combining Files" $VAR +pandoc ./dist/combined-guide.md -o ./dist/owasp-docker-security.pdf +# cat './dist/combined-guide.md' | md-to-pdf > ./dist/owasp-docker-security.pdf \ No newline at end of file