Minimize build size with -Os and -split-sections
This commit is contained in:
parent
797b424917
commit
10edba3ab8
|
@ -9,13 +9,13 @@ RUN apt-get update && apt-get install -y ghc cabal-install
|
||||||
# Install Haskell deps
|
# Install Haskell deps
|
||||||
# (This is a separate copy/run so that source changes don't require rebuilding)
|
# (This is a separate copy/run so that source changes don't require rebuilding)
|
||||||
COPY ShellCheck.cabal ./
|
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 source and build it
|
||||||
COPY LICENSE Setup.hs shellcheck.hs ./
|
COPY LICENSE Setup.hs shellcheck.hs ./
|
||||||
COPY src src
|
COPY src src
|
||||||
RUN cabal build Paths_ShellCheck && \
|
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
|
strip --strip-all shellcheck
|
||||||
|
|
||||||
RUN mkdir -p /out/bin && \
|
RUN mkdir -p /out/bin && \
|
||||||
|
|
Loading…
Reference in New Issue