mirror of
https://github.com/semaphoreci/book-cicd-docker-kubernetes.git
synced 2026-02-14 15:59:50 +00:00
97 lines
3.6 KiB
Makefile
97 lines
3.6 KiB
Makefile
BUILD = build
|
|
BOOKNAME = CICD_with_Docker_Kubernetes_Semaphore
|
|
TITLE = title.txt
|
|
CHAPTERS = chapters/01-introduction.md chapters/02-using-docker.md \
|
|
chapters/03-kubernetes-deployment.md chapters/04-cicd-best-practices.md \
|
|
chapters/05-tutorial-intro.md chapters/06-tutorial-semaphore.md \
|
|
chapters/07-tutorial-clouds.md chapters/08-tutorial-deployment.md \
|
|
chapters/09-final-words.md
|
|
|
|
CHAPTERS_EBOOK = chapters/01-introduction-ebook.md chapters/02-using-docker.md \
|
|
chapters/03-kubernetes-deployment.md chapters/04-cicd-best-practices.md \
|
|
chapters/05-tutorial-intro.md chapters/06-tutorial-semaphore.md \
|
|
chapters/07-tutorial-clouds.md chapters/08-tutorial-deployment.md \
|
|
chapters/09-final-words-ebook.md
|
|
|
|
# handle non-intel archs (eg. Apple M1)
|
|
EXTRA_OPTS =
|
|
ARCH = $(shell arch)
|
|
ifeq ($(ARCH),arm64)
|
|
EXTRA_OPTS += --platform linux/amd64
|
|
endif
|
|
|
|
all: book
|
|
|
|
book: pdf ebook
|
|
ebook: epub mobi
|
|
docx: $(BUILD)/docx/$(BOOKNAME).docx
|
|
pdf: $(BUILD)/pdf/$(BOOKNAME).pdf
|
|
epub: $(BUILD)/epub/$(BOOKNAME).epub
|
|
mobi: $(BUILD)/mobi/$(BOOKNAME).mobi
|
|
azw3: $(BUILD)/azw3/$(BOOKNAME).azw3
|
|
html: $(BUILD)/html/$(BOOKNAME).html
|
|
more: $(BUILD)/pdf/more.pdf
|
|
|
|
clean:
|
|
rm -r $(BUILD)
|
|
|
|
$(BUILD)/docx/$(BOOKNAME).docx: $(TITLE) $(CHAPTERS)
|
|
mkdir -p $(BUILD)/docx
|
|
docker run --rm $(EXTRA_OPTS) --volume `pwd`:/data pandoc/latex:2.6 -f markdown-implicit_figures -H make-code-small.tex -V geometry:margin=1.5in -o /data/$@ $^
|
|
|
|
$(BUILD)/pdf/$(BOOKNAME).pdf: $(TITLE) $(CHAPTERS)
|
|
mkdir -p $(BUILD)/pdf
|
|
docker run --rm $(EXTRA_OPTS) \
|
|
--volume `pwd`:/data pandoc/latex:2.6 \
|
|
-f markdown-implicit_figures \
|
|
-H make-code-small.tex \
|
|
-V geometry:margin=1.5in \
|
|
-o /data/$@ $^
|
|
|
|
$(BUILD)/pdf/more.pdf: chapters/10-wait-there-is-more.md
|
|
mkdir -p $(BUILD)/pdf
|
|
docker run --rm $(EXTRA_OPTS) \
|
|
--volume `pwd`:/data pandoc/latex:2.6 \
|
|
-f markdown-implicit_figures \
|
|
-H make-code-small.tex \
|
|
-V geometry:margin=1.5in \
|
|
-o /data/$@ $^
|
|
|
|
# intermediate format for epub, uses small figures
|
|
$(BUILD)/html/$(BOOKNAME).html: title.txt $(CHAPTERS_EBOOK)
|
|
mkdir -p $(BUILD)/html $(BUILD)/html/figures
|
|
cp figures/* $(BUILD)/html/figures
|
|
cp figures-ebook/* $(BUILD)/html/figures
|
|
docker run --rm $(EXTRA_OPTS) \
|
|
--volume `pwd`:/data pandoc/crossref:2.10 \
|
|
-o /data/$@ $^
|
|
|
|
# kindle-optimized epub
|
|
# note: output-profile=tablet converts best to kindle
|
|
$(BUILD)/epub/$(BOOKNAME).epub: $(BUILD)/html/$(BOOKNAME).html
|
|
mkdir -p $(BUILD)/epub
|
|
docker run --rm $(EXTRA_OPTS) --volume `pwd`:/data --entrypoint ebook-convert -w /data linuxserver/calibre $^ /data/$@ \
|
|
--output-profile tablet \
|
|
--chapter "//*[name()='h1' or name()='h2']" \
|
|
--publisher "Semaphore" \
|
|
--book-producer "Semaphore" \
|
|
--cover cover/cover.jpg \
|
|
--epub-version 3 \
|
|
--extra-css /data/styles/epub-kindle.css \
|
|
--language "$(shell egrep '^language:' title.txt | cut -d: -f2 | sed -e 's/^[[:space:]]*//')" \
|
|
--title "$(shell egrep '^title:' title.txt | cut -d: -f2 | sed -e 's/^[[:space:]]*//')" \
|
|
--comments "$(shell egrep '^subtitle:' title.txt | cut -d: -f2 | sed -e 's/^[[:space:]]*//')" \
|
|
--authors "$(shell egrep '^author:' title.txt | cut -d: -f2 | sed -e 's/^[[:space:]]*//')"
|
|
|
|
# mobipocket format
|
|
$(BUILD)/mobi/$(BOOKNAME).mobi: $(BUILD)/epub/$(BOOKNAME).epub
|
|
mkdir -p $(BUILD)/mobi
|
|
docker run --rm --volume `pwd`:/data --entrypoint ebook-convert -w /data linuxserver/calibre $^ /data/$@
|
|
|
|
# amazon kindle format (for testing)
|
|
$(BUILD)/azw3/$(BOOKNAME).azw3: $(BUILD)/epub/$(BOOKNAME).epub
|
|
mkdir -p $(BUILD)/azw3
|
|
docker run --rm --volume `pwd`:/data --entrypoint ebook-convert -w /data linuxserver/calibre $^ /data/$@
|
|
|
|
.PHONY: all book clean pdf html epub azw3 mobi
|