diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-17 16:02:49 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-17 16:02:49 +0100 |
commit | 037af1b95bc364efd7a040afea516e9f1026c124 (patch) | |
tree | d17a3ca559a4acf7cea74de2063a447fd5d3c819 /static-linux | |
parent | 63c96f8b91b26f4c12a48ea30f330d689b4c67fa (diff) | |
download | pandoc-037af1b95bc364efd7a040afea516e9f1026c124.tar.gz |
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.
Diffstat (limited to 'static-linux')
-rw-r--r-- | static-linux/Dockerfile | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/static-linux/Dockerfile b/static-linux/Dockerfile index 3c62ebcf9..b0b169120 100644 --- a/static-linux/Dockerfile +++ b/static-linux/Dockerfile @@ -9,10 +9,13 @@ RUN apk update RUN apk add alpine-sdk git ca-certificates ghc cabal stack zlib-dev RUN stack update RUN stack config set system-ghc --global true -ADD ./ /usr/src/ +RUN mkdir -p /etc/stack +RUN echo "build: { split-objs: true }" > /etc/stack/config.yaml +RUN mkdir -p /usr/src/ WORKDIR /usr/src/ RUN git clone https://github.com/jgm/pandoc WORKDIR /usr/src/pandoc +RUN stack install --local-bin-path /usr/bin hsb2hs +RUN stack install --only-dependencies --flag 'pandoc:embed_data_files' --test --ghc-options '-O2 -optc-Os -optl-static -fPIC' CMD git pull -CMD stack install --local-bin-path /usr/bin hsb2hs -CMD stack install --local-bin-path /artifacts --flag 'pandoc:embed_data_files' --test --ghc-options '-optl-static -fPIC' +CMD stack install --local-bin-path /artifacts --flag 'pandoc:embed_data_files' --test --ghc-options '-O2 -optc-Os -optl-static -fPIC' |