mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-20 13:23:55 -07:00
Allow more Docker build caching
This commit is contained in:
parent
5364701914
commit
71bcc80c2f
2 changed files with 32 additions and 22 deletions
31
Dockerfile
31
Dockerfile
|
@ -1,23 +1,34 @@
|
|||
FROM ubuntu:16.04 AS build
|
||||
|
||||
# Install GHC and cabal
|
||||
# Build-only image
|
||||
FROM ubuntu:17.10 AS build
|
||||
USER root
|
||||
WORKDIR /opt/shellCheck
|
||||
|
||||
COPY . .
|
||||
# Install OS deps
|
||||
RUN apt-get update && apt-get install -y ghc cabal-install
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ghc \
|
||||
cabal-install
|
||||
RUN cabal update && \
|
||||
cabal install --dependencies-only
|
||||
# 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 -idist/build/autogen --make 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 <vidar@vidarholen.net>"
|
||||
COPY --from=build /out /
|
||||
|
||||
# DELETE-MARKER (Remove everything below to keep the alpine image)
|
||||
|
||||
# Resulting ShellCheck image
|
||||
FROM scratch
|
||||
LABEL maintainer="Vidar Holen <vidar@vidarholen.net>"
|
||||
WORKDIR /
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue