Simplify Dockerfile

Use multi stage Dockerfile to greatly simplify build.
This commit is contained in:
Pratik Mallya 2018-03-14 05:25:52 -05:00
parent fb97aca5a6
commit 71df01c00f
1 changed files with 22 additions and 7 deletions

View File

@ -1,10 +1,25 @@
FROM ubuntu:16.04 AS build
# Install GHC and cabal
USER root
WORKDIR /opt/shellCheck
COPY . .
RUN apt-get update && apt-get install -y \
ghc \
cabal-install
RUN cabal update && \
cabal install --dependencies-only
RUN cabal build Paths_ShellCheck && \
ghc -optl-static -optl-pthread -idist/build/autogen --make shellcheck && \
strip --strip-all shellcheck
RUN mkdir -p /out/bin && \
cp shellcheck /out/bin/
FROM scratch
LABEL maintainer="Vidar Holen <vidar@vidarholen.net>"
# This file assumes ShellCheck has already been built.
# See https://github.com/koalaman/scbuilder
COPY shellcheck /bin/shellcheck
WORKDIR /mnt
WORKDIR /
COPY --from=build /out /
ENTRYPOINT ["/bin/shellcheck"]