Compare commits

..

2 Commits

Author SHA1 Message Date
af93017204 Use Docker to invoke ChordPro
Some checks failed
Build / build (push) Failing after 2s
This allows us to run Make in a predictable environemnt without having
to install all the perl dependencies. It should work both locally
and during build in the pipeline.
2024-06-01 12:09:55 +02:00
26ada96c25 Describe Docker usage
[ci skip]
2024-06-01 12:07:45 +02:00
2 changed files with 11 additions and 19 deletions

View File

@ -1,3 +1,9 @@
ifdef CHORDPRO_PIPELINE
CHORDPRO_CMD = chordpro
else
CHORDPRO_CMD = docker run -ti --rm --env HOME=$(HOME) --env USER=$(USER) --workdir $(shell pwd) --volume $(HOME):$(HOME) chordpro/chordpro:latest chordpro --config=chordpro.json
endif
SRC_DIR := $(wildcard content/*)
SRC_EXTENSION := .cho
@ -6,15 +12,13 @@ SONG_PDF := $(patsubst %$(SRC_EXTENSION),%.pdf,$(SONG_CHO))
SONG_HTML := $(patsubst %$(SRC_EXTENSION),%.html,$(SONG_CHO))
SONGBOOK := songbook.pdf
SHELL := $(shell echo $$SHELL)
.DEFAULT_GOAL := all
%.pdf: %$(SRC_EXTENSION)
$(SHELL) -c 'chordpro --config=chordpro.json -o $@ $<'
$(CHORDPRO_CMD) -o $@ $<
%.html: %$(SRC_EXTENSION)
$(SHELL) -c 'chordpro --config=chordpro.json -o $@ $<'
$(CHORDPRO_CMD) -o $@ $<
all: $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)

View File

@ -4,26 +4,14 @@
- `ghostscript`
- `zola` (optional)
You can [install ChordPro][1] directly on your machine, or use Docker
with the official iamge `chordpro/chordpro:latest`. It can be seamlesly
integrated with a shell alias:
The makefile uses Docker with the official iamge `chordpro/chordpro:latest`.
It can be seamlesly integrated with a shell alias in case you want to use
chordpro directly in your shell outside of make:
```
alias chordpro="docker run -ti --rm --env HOME=\$HOME --env USER=\$USER --workdir \$(pwd) --volume \$HOME:\$HOME chordpro/chordpro:latest chordpro"
```
This will not function with the included makefile, so you will have to
export this as a shell function (for example in `.bashrc`):
```
chordpro() {
docker run -ti --rm --env HOME=$HOME --env USER=$USER --workdir "$(pwd)" --volume "$HOME:$HOME" chordpro/chordpro:latest chordpro "$@"
}
export -f chordpro
```
[1]: https://www.chordpro.org/chordpro/chordpro-installation/
## Building
`make` defaults to `all` which builds individual PDF and HTML files for