Skip to content

Commit

Permalink
Merge branch 'master' into 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
reijoh committed May 7, 2024
2 parents 2099244 + 3ac79af commit cc2cfcf
Show file tree
Hide file tree
Showing 19 changed files with 886 additions and 146 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
stacks: ${{ steps.config.outputs.stacks }}
build: ${{ steps.config.outputs.build }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.after }}
- name: Configure build
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
STACK: ${{ matrix.stack }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Show config
run: make show-args
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ endef
# Generate convenience targets for all supported stacks.
$(foreach img,$(image_stacks),$(eval $(call stack,$(img))))

export TEXLIVE_MIRROR_URL

# Freeze ################################################################
.PHONY: freeze-file
freeze-file: $(STACK)/$(stack_freeze_file)
Expand All @@ -112,7 +114,7 @@ freeze-file: $(STACK)/$(stack_freeze_file)
$(docker_cpu_options)
docker run --rm \
-v "$(makefile_dir):/app" \
--env WITHOUT_CROSSREF=true \
--env WITHOUT_CROSSREF=$(WITHOUT_CROSSREF) \
ghcr.io/innofactororg/$(STACK)-builder-base:latest-$(STACK) \
sh /app/common/pandoc-freeze.sh \
-c $(PANDOC_COMMIT) \
Expand Down
72 changes: 30 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This repo contains a collection of Dockerfiles to build various
- [Available Images](#available-images)
- [Usage](#usage)
- [Basic Usage](#basic-usage)
- [Pandoc Scripts](#pandoc-scripts)
- [GitHub Actions](#github-actions)
- [Building custom images](#building-custom-images)
- [Internationalized LaTeX images](#internationalized-latex-images)
- [License](#license)

Available Images
Expand Down Expand Up @@ -95,47 +95,6 @@ Basic Usage
the next time. You don't have to worry about where/how Docker keeps these
images.

Pandoc Scripts
--------------------------------------------------------------------------------

Pandoc commands have a way of getting pretty long, and so typing them into the
command line can get a little unwieldy. To get a better handle of long pandoc
commands, you can store them in a script file, a simple text file with an `*.sh`
extension such as

```sh
#!/bin/sh
pandoc README.md
```

The first line, known as the [*shebang*](https://stackoverflow.com/q/7366775)
tells the container that the following commands are to be executed as shell
commands. In our case, we really don't use a lot of shell magic, we just call
pandoc in the second line (though you can get fancier, if you like). Notice that
the `#!/bin/sh` will *not* get you a full bash shell, but only the more basic
ash shell that comes with Alpine linux on which the pandoc containers are based.
This won't matter for most uses, but if you want to write writing more
complicated scripts you may want to refer to the [`ash`
manual](https://linux.die.net/man/1/ash).

Once you have stored this script, you must make it executable by running the
following command on it (this may apply only to UNIX-type systems):

```sh
chmod +x script.sh
```

You only have to do this once for each script file.

You can then run the completed script file in a pandoc docker container like so:

```sh
docker run --rm --volume "`pwd`:/data" --entrypoint "/data/script.sh" ghcr.io/innofactororg/pandoc-extra:3.1.13-alpine
```

Notice that the above `script.sh` *did* specify `pandoc`, and you can't just
omit it as in the simpler command above.

GitHub Actions
--------------------------------------------------------------------------------

Expand Down Expand Up @@ -181,6 +140,35 @@ Started guide](https://docs.docker.com/get-started/part2/).

[spellcheck](https://github.com/pandoc/lua-filters/tree/master/spellcheck)

### Internationalized LaTeX images

This very method can be used to create images with support for
additional fonts. This is of particular importance for the processing of
documents written in a language that uses non-Latin characters.

Below is an example Dockerfile that can be used to build a custom image with
support for Ukrainian. It adds the necessary LaTeX packages via `tlmgr` and
installs *Linux Libertine* as a font with support for Cyrillic.

``` Dockerfile
FROM pandoc/latex
RUN tlmgr install babel-ukrainian
RUN apk --no-cache add font-linux-libertine
```

After building a new image as described in the previous section, the
image can then be used to convert documents such as:

``` markdown
---
title: "Приклад українською"
mainfont: Linux Libertine
lang: uk
---

Цей текст не дуже цікавий.
```

License
================================================================================

Expand Down
38 changes: 25 additions & 13 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ FROM alpine-core as alpine-latex

# NOTE: to maintainers, please keep this listing alphabetical.
RUN apk --no-cache add \
bind-tools \
curl \
fontconfig \
freetype \
Expand Down Expand Up @@ -162,13 +161,22 @@ COPY common/latex/packages.txt /root/packages.txt
# TeXLive version to install (leave empty to use the latest version).
ARG texlive_version=

# TeXLive mirror URL (leave empty to use the default mirror).
ARG texlive_mirror_url=

# Request musl precompiled binary access
RUN echo "binary_x86_64-linuxmusl 1" >> /root/texlive.profile && \
/root/install-texlive.sh $texlive_version && \
sed -e 's/ *#.*$//' -e '/^ *$/d' /root/packages.txt | xargs tlmgr install && \
rm -f /root/texlive.profile /root/install-texlive.sh /root/packages.txt && \
TERM=dumb luaotfload-tool --update && \
chmod -R o+w /opt/texlive/texdir/texmf-var
RUN echo "binary_x86_64-linuxmusl 1" >> /root/texlive.profile \
&& ( \
[ -z "$texlive_version" ] || printf '-t\n%s\n"' "$texlive_version"; \
[ -z "$texlive_mirror_url" ] || printf '-m\n%s\n' "$texlive_mirror_url" \
) | xargs /root/install-texlive.sh \
&& sed -e 's/ *#.*$//' -e '/^ *$/d' /root/packages.txt | \
xargs tlmgr install \
&& rm -f /root/texlive.profile \
/root/install-texlive.sh \
/root/packages.txt \
&& TERM=dumb luaotfload-tool --update \
&& chmod -R o+w /opt/texlive/texdir/texmf-var

WORKDIR /data

Expand All @@ -181,18 +189,22 @@ RUN apk --no-cache add \
font-carlito \
git \
jq \
py-pip \
shadow \
sudo

COPY common/extra/packages.txt /root/extra_packages.txt
COPY common/extra/requirements.txt /root/extra_requirements.txt

RUN sed -e 's/ *#.*$//' -e '/^ *$/d' /root/extra_packages.txt | xargs tlmgr install && \
rm -f /root/extra_packages.txt

RUN python3 -m pip install --break-system-packages --no-cache-dir \
pandoc-latex-environment
# The option `--break-system-packages` sounds bad but this is not
# really a problem here because we are not using Python apk packages
# anyway.
RUN apk --no-cache add py-pip \
&& pip3 install -r /root/extra_requirements.txt --break-system-packages \
&& rm -f /root/extra_requirements.txt

RUN sed -e 's/ *#.*$//' -e '/^ *$/d' /root/extra_packages.txt | \
xargs tlmgr install \
&& rm -f /root/extra_packages.txt
ARG TEMPLATES_DIR=/.pandoc/templates

RUN mkdir -p ${TEMPLATES_DIR} && \
Expand Down
48 changes: 29 additions & 19 deletions alpine/freeze/pandoc-3.1.13.project.freeze
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ constraints: any.Cabal ==3.8.1.0,
any.SHA ==1.6.4.4,
SHA -exe,
any.StateVar ==1.2.2,
any.aeson ==2.1.2.1,
aeson -cffi +ordered-keymap,
any.aeson ==2.2.1.0,
aeson +ordered-keymap,
any.aeson-pretty ==0.8.10,
aeson-pretty +lib-only,
any.alex ==3.5.1.0,
any.ansi-terminal ==1.1,
any.ansi-terminal ==1.1.1,
ansi-terminal -example,
any.ansi-terminal-types ==1.1,
any.appar ==0.1.8,
Expand All @@ -34,8 +34,7 @@ constraints: any.Cabal ==3.8.1.0,
any.auto-update ==0.1.6,
any.base ==4.17.2.0,
any.base-compat ==0.13.1,
any.base-compat-batteries ==0.13.1,
any.base-orphans ==0.9.1,
any.base-orphans ==0.9.2,
any.base-unicode-symbols ==0.2.4.2,
base-unicode-symbols +base-4-8 -old-base,
any.base16-bytestring ==1.0.2.0,
Expand All @@ -57,8 +56,7 @@ constraints: any.Cabal ==3.8.1.0,
any.cabal-doctest ==1.0.9,
any.call-stack ==0.4.0,
any.case-insensitive ==1.2.1.0,
any.cassava ==0.5.3.0,
cassava -bytestring--lt-0_10_4,
any.cassava ==0.5.3.1,
any.cborg ==0.2.10.0,
cborg +optimize-gmp,
any.cereal ==0.5.8.3,
Expand All @@ -73,12 +71,12 @@ constraints: any.Cabal ==3.8.1.0,
comonad +containers +distributive +indexed-traversable,
any.conduit ==1.3.5,
any.conduit-extra ==1.3.6,
any.constraints ==0.14,
any.constraints ==0.14.1,
any.containers ==0.6.7,
any.contravariant ==1.5.5,
contravariant +semigroups +statevar +tagged,
any.cookie ==0.4.6,
any.crypton ==0.34,
any.crypton ==1.0.0,
crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
any.crypton-connection ==0.3.2,
any.crypton-x509 ==1.7.6,
Expand Down Expand Up @@ -115,6 +113,7 @@ constraints: any.Cabal ==3.8.1.0,
any.ghc-bignum ==1.3,
any.ghc-boot-th ==9.4.7,
any.ghc-prim ==0.9.1,
any.gitrev ==1.3.1,
any.gridtables ==0.1.0.0,
any.haddock-library ==1.11.0,
any.half ==0.3.1,
Expand All @@ -141,6 +140,9 @@ constraints: any.Cabal ==3.8.1.0,
any.hslua-module-zip ==1.1.1,
any.hslua-objectorientation ==2.3.1,
any.hslua-packaging ==2.3.1,
any.hslua-repl ==0.1.2,
hslua-repl -executable,
any.hslua-typing ==0.1.1,
any.http-api-data ==0.6,
http-api-data -use-text-show,
any.http-client ==0.7.17,
Expand All @@ -159,16 +161,21 @@ constraints: any.Cabal ==3.8.1.0,
integer-logarithms -check-bounds +integer-gmp,
any.iproute ==1.7.12,
any.ipynb ==0.2,
any.isocline ==1.0.9,
any.jira-wiki-markup ==1.5.1,
any.libyaml ==0.1.4,
libyaml -no-unicode -system-libyaml,
any.libyaml-clib ==0.2.5,
any.lpeg ==1.1.0,
lpeg +rely-on-shared-lpeg-library,
any.lua ==2.3.2,
lua +allow-unsafe-gc -apicheck -export-dynamic -lua_32bits +pkg-config +system-lua,
lua +allow-unsafe-gc -apicheck -cross-compile -export-dynamic -lua_32bits +pkg-config +system-lua,
any.memory ==0.18.0,
memory +support_bytestring +support_deepseq,
any.microlens ==0.4.13.1,
any.microlens-ghc ==0.4.14.3,
any.microlens-mtl ==0.2.0.3,
any.microlens-th ==0.4.3.15,
any.mime-types ==0.1.2.0,
any.mmorph ==1.2.0,
any.monad-control ==1.0.3.1,
Expand All @@ -181,13 +188,16 @@ constraints: any.Cabal ==3.8.1.0,
any.network-uri ==2.6.4.2,
any.old-locale ==1.0.0.7,
any.old-time ==1.1.0.4,
any.open-browser ==0.2.1.0,
any.optparse-applicative ==0.18.1.0,
optparse-applicative +process,
any.ordered-containers ==0.2.3,
any.os-string ==2.0.2,
any.os-string ==2.0.2.1,
any.pandoc ==3.1.13,
pandoc +embed_data_files,
pandoc-cli +lua -nightly +server,
any.pandoc-crossref ==0.3.17.0,
pandoc-crossref -enable_flaky_tests,
any.pandoc-lua-engine ==0.2.1.3,
any.pandoc-lua-marshal ==0.2.6,
any.pandoc-server ==0.1.0.5,
Expand All @@ -199,7 +209,7 @@ constraints: any.Cabal ==3.8.1.0,
any.prettyprinter ==1.7.1,
prettyprinter -buildreadme +text,
any.prettyprinter-ansi-terminal ==1.1.3,
any.primitive ==0.8.0.0,
any.primitive ==0.9.0.0,
any.process ==1.6.17.0,
any.psqueues ==0.2.8.0,
any.random ==1.2.1.2,
Expand Down Expand Up @@ -257,7 +267,7 @@ constraints: any.Cabal ==3.8.1.0,
any.text-iso8601 ==0.1,
any.text-short ==0.1.5,
text-short -asserts,
any.th-abstraction ==0.5.0.0,
any.th-abstraction ==0.6.0.0,
any.th-compat ==0.1.5,
any.th-lift ==0.8.4,
any.th-lift-instances ==0.1.20,
Expand All @@ -266,15 +276,14 @@ constraints: any.Cabal ==3.8.1.0,
any.time-compat ==1.9.6.1,
time-compat -old-locale,
any.time-manager ==0.0.1,
any.tls ==2.0.2,
any.tls ==2.0.5,
tls -devel,
any.toml-parser ==2.0.0.0,
any.transformers ==0.5.6.2,
any.transformers-base ==0.4.6,
transformers-base +orphaninstances,
any.transformers-compat ==0.7.2,
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
any.type-equality ==1,
any.typed-process ==0.2.11.1,
any.typst ==0.5.0.3,
typst -executable,
Expand All @@ -295,6 +304,7 @@ constraints: any.Cabal ==3.8.1.0,
any.unordered-containers ==0.2.20,
unordered-containers -debug,
any.utf8-string ==1.0.2,
any.utility-ht ==0.0.17.1,
any.uuid-types ==1.0.5.1,
any.vault ==0.3.1.5,
vault +useghc,
Expand All @@ -319,8 +329,8 @@ constraints: any.Cabal ==3.8.1.0,
any.xml-types ==0.3.8,
any.yaml ==0.11.11.2,
yaml +no-examples +no-exe,
any.zip-archive ==0.4.3.1,
any.zip-archive ==0.4.3.2,
zip-archive -executable,
any.zlib ==0.6.3.0,
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config
index-state: hackage.haskell.org 2024-04-09T09:10:13Z
any.zlib ==0.7.1.0,
zlib -bundled-c-zlib +non-blocking-ffi +pkg-config
index-state: hackage.haskell.org 2024-05-03T13:19:35Z
2 changes: 1 addition & 1 deletion alpine/freeze/pandoc-main.project.freeze
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
constraints: lua +system-lua +pkg-config +hardcode-reg-keys -export-dynamic,
lpeg +rely-on-shared-lpeg-library,
lpeg -rely-on-shared-lpeg-library,
aeson-pretty +lib-only,
pandoc +embed_data_files,
pandoc-cli +lua +nightly +server
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ case "$action" in
--build-arg extra_packages="${extra_packages}"\
--build-arg base_image_version="${base_image_version}" \
--build-arg texlive_version="${texlive_version}" \
--build-arg texlive_mirror_url="${TEXLIVE_MIRROR_URL}" \
--build-arg lua_version="${lua_version}" \
--target "${target}" \
--cache-from type=gha \
Expand Down
1 change: 1 addition & 0 deletions common/extra/packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ background
bidi
#catchfile
collectbox
cm-super
csquotes
#everypage
filehook
Expand Down
2 changes: 1 addition & 1 deletion common/extra/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# because minor versions (e.g. `1.3.6`) _should_ not break things
#

pandoc-latex-environment>=1.1
pandoc-latex-environment==1.1.*
Loading

0 comments on commit cc2cfcf

Please sign in to comment.