From 10edba3ab82d58fb262a6ab3cc0245c0e6372259 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Thu, 12 Jul 2018 09:33:59 -0700 Subject: [PATCH] Minimize build size with -Os and -split-sections --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4857acb..5ecfd08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,13 +9,13 @@ RUN apt-get update && apt-get install -y ghc cabal-install # Install Haskell deps # (This is a separate copy/run so that source changes don't require rebuilding) COPY ShellCheck.cabal ./ -RUN cabal update && cabal install --dependencies-only +RUN cabal update && cabal install --dependencies-only --ghc-options="-optlo-Os -split-sections" # Copy source and build it COPY LICENSE Setup.hs shellcheck.hs ./ COPY src src RUN cabal build Paths_ShellCheck && \ - ghc -optl-static -optl-pthread -isrc -idist/build/autogen --make shellcheck && \ + ghc -optl-static -optl-pthread -isrc -idist/build/autogen --make shellcheck -split-sections -optc-Wl,--gc-sections -optlo-Os && \ strip --strip-all shellcheck RUN mkdir -p /out/bin && \