git.iko.soy/typeable/pandoc
on master help sign in
Improved static linux alpine build.

* Use -split-objs (reduces executable size from ~50M to 32M), at cost of much slower compilation. * Moved building of prereqs from CMD to RUN, so they can be cached. Doing 'make build' will fetch the latest from git and rebuild pandoc, but dependencies needn't be rebuilt.

commit037af1b95bc364efd7a040afea516e9f1026c124 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 17 Mar 2017, 16:02 (10 years ago) parent63c96f8
1 file changed+6−3
static-linux/Dockerfile+6−3
static-linux/Dockerfile+6−3
@@ -9,10 +9,13 @@ RUN apk update
99RUN apk add alpine-sdk git ca-certificates ghc cabal stack zlib-dev
1010RUN stack update
1111RUN stack config set system-ghc --global true
12−ADD ./ /usr/src/
12+RUN mkdir -p /etc/stack
13+RUN echo "build: { split-objs: true }" > /etc/stack/config.yaml
14+RUN mkdir -p /usr/src/
1315WORKDIR /usr/src/
1416RUN git clone https://github.com/jgm/pandoc
1517WORKDIR /usr/src/pandoc
18+RUN stack install --local-bin-path /usr/bin hsb2hs
19+RUN stack install --only-dependencies --flag 'pandoc:embed_data_files' --test --ghc-options '-O2 -optc-Os -optl-static -fPIC'
1620CMD git pull
17−CMD stack install --local-bin-path /usr/bin hsb2hs
18−CMD stack install --local-bin-path /artifacts --flag 'pandoc:embed_data_files' --test --ghc-options '-optl-static -fPIC'
21+CMD stack install --local-bin-path /artifacts --flag 'pandoc:embed_data_files' --test --ghc-options '-O2 -optc-Os -optl-static -fPIC'