forked from koalaman/shellcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pratikmallya-simplify_dockerbuild'
- Loading branch information
Showing
2 changed files
with
42 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
FROM scratch | ||
# Build-only image | ||
FROM ubuntu:17.10 AS build | ||
USER root | ||
WORKDIR /opt/shellCheck | ||
|
||
# Install OS deps | ||
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 | ||
|
||
# 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 && \ | ||
strip --strip-all shellcheck | ||
|
||
RUN mkdir -p /out/bin && \ | ||
cp shellcheck /out/bin/ | ||
|
||
# Resulting Alpine image | ||
FROM alpine:latest | ||
LABEL maintainer="Vidar Holen <[email protected]>" | ||
COPY --from=build /out / | ||
|
||
# This file assumes ShellCheck has already been built. | ||
# See https://github.com/koalaman/scbuilder | ||
COPY shellcheck /bin/shellcheck | ||
# DELETE-MARKER (Remove everything below to keep the alpine image) | ||
|
||
WORKDIR /mnt | ||
# Resulting ShellCheck image | ||
FROM scratch | ||
LABEL maintainer="Vidar Holen <[email protected]>" | ||
WORKDIR / | ||
COPY --from=build /out / | ||
ENTRYPOINT ["/bin/shellcheck"] |