Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
FROM lrx0014/gitbook:3.2.3
FROM kyselejsyrecek/gitbook:3.2.3
COPY ./ /srv/gitbook/
EXPOSE 4000
WORKDIR /srv/gitbook
CMD ["sh", "-c", "/usr/local/bin/gitbook serve"]

# Update sources.list for Debian Jessie.
RUN rm /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list.d/jessie.list
RUN echo "deb http://archive.debian.org/debian jessie main" >> /etc/apt/sources.list.d/jessie.list
RUN apt update
RUN apt install -y --force-yes calibre bzip2
RUN npm install svgexport@0.3.0 -g

# Install CommandBox (https://commandbox.ortusbooks.com/setup/installation).
# Requires OpenJDK 11 but only version 7 is available from Debian Jessie repositories.
# Run that on a more up-to-date system.
#RUN apt install -y libappindicator3-dev openjdk-11-jdk
#RUN curl -fsSl https://downloads.ortussolutions.com/debs/gpg | gpg --dearmor | tee /usr/share/keyrings/ortussolutions.gpg > /dev/null
#RUN echo "deb [signed-by=/usr/share/keyrings/ortussolutions.gpg] https://downloads.ortussolutions.com/debs/noarch /" | tee /etc/apt/sources.list.d/commandbox.list
#RUN apt-get update && apt-get install -y apt-transport-https commandbox

# Install gitbook-exporter into the CommandBox.
#RUN box install gitbook-exporter

# Run CommandBox shell with gitbook command available. (https://www.forgebox.io/view/gitbook-exporter)
# Examples:
#RUN gitbook pdf
#RUN gitbook epub
Expand Down
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ image: ## docker image build ...

.PHONY: sh
sh: ## run interactive shell inside an already running docker container ...
docker exec -it linux-insides-book sh
docker exec -it linux-insides-book bash

.PHONY: rm
rm: ## remove the docker container ...
Expand All @@ -35,15 +35,26 @@ logs: ## gather logs from the docker container ...

.PHONY: export
export: ## run e-book generation inside an already running docker container ...
docker exec linux-insides-book /bin/bash -c " \
docker exec linux-insides-book /bin/bash -c ' \
find . -type f -name '*.svg' -a ! \( -path "./.github/*" -o -path "./_book/*" \) -print0 | while IFS= read -r -d "" svg_file; do \
output_file="$${svg_file%.svg}.png"; \
chapter_dir=$$(dirname $$(dirname "$$svg_file")); \
svg_relative_path="$${svg_file#$$chapter_dir/}"; \
output_relative_path="$${output_file#$$chapter_dir/}"; \
inkscape --export-png="$$output_file" \
--export-area-page \
--export-dpi=150 \
"$$svg_file"; \
find "$$chapter_dir" -maxdepth 1 -type f -name "*.md" -print0 | xargs -0 sed -i "s|\\([/ \\t\\(]\\)$${svg_relative_path}|\\1$${output_relative_path}|g"; \
done; \
gitbook epub; \
gitbook mobi; \
gitbook pdf; \
mv book.pdf book-A4.pdf; \
mv book-A5.json book.json; \
gitbook pdf; \
mv book.pdf book-A5.pdf; \
mv book-A4.pdf book.pdf"
mv book-A4.pdf book.pdf'

.PHONY: cp
cp: ## copy all exported e-book formats to current working directory ...
Expand Down