use all in one method to build shellcheck

This commit is contained in:
sparklyballs 2016-11-15 18:39:02 +00:00
parent 29c557165b
commit 796a388de0
2 changed files with 38 additions and 61 deletions

View File

@ -1,16 +1,46 @@
FROM alpine:3.4
MAINTAINER sparklyballs
# copy files from jenkins builder job
COPY package/bin/shellcheck /usr/local/bin/
COPY package/lib/ /usr/local/lib/
# load lib files
RUN \
ldconfig /usr/local/lib
# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
# copy apk key
COPY mitch.tishmack@gmail.com-55881c97.rsa.pub /etc/apk/keys/mitch.tishmack@gmail.com-55881c97.rsa.pub
# install packages
RUN \
echo "https://s3-us-west-2.amazonaws.com/alpine-ghc/next/8.0" >> /etc/apk/repositories && \
apk add --no-cache --virtual=build-dependencies \
bash \
binutils \
cabal \
g++ \
gcc \
ghc \
ghc-dev \
git \
make \
stack && \
# update cabal and stack
cabal \
update && \
stack \
update && \
# compile shellcheck
cabal install ShellCheck && \
cp /root/.cabal/bin/shellcheck /usr/local/bin/ && \
ldd /root/.cabal/bin/shellcheck | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /usr/local/lib/ && \
ldconfig /usr/local/lib && \
# clean up
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/* && \
find /root -name . -o -prune -exec rm -rf -- {} + && \
mkdir -p \
/root

View File

@ -1,53 +0,0 @@
FROM alpine:3.4
MAINTAINER sparklyballs
# environment settings
ENV PATH ${PATH}:/root/.cabal/bin
# copy apk key
COPY mitch.tishmack@gmail.com-55881c97.rsa.pub /etc/apk/keys/mitch.tishmack@gmail.com-55881c97.rsa.pub
# install packages
RUN \
echo "https://s3-us-west-2.amazonaws.com/alpine-ghc/next/8.0" >> /etc/apk/repositories && \
apk add --no-cache \
bash \
binutils \
cabal \
g++ \
gcc \
ghc \
ghc-dev \
git \
make \
stack && \
# update cabal and stack
cabal \
update && \
stack \
update && \
# clone shellcheck repo
git clone https://github.com/koalaman/shellcheck /usr/src/shellcheck
# compile shellcheck
WORKDIR /usr/src/shellcheck
RUN \
cabal install --only-dependencies
RUN \
cabal install
RUN \
cabal test
# Get shellcheck binary
RUN mkdir -p /package/bin/
RUN cp $(which shellcheck) /package/bin/
# Get shared libraries using magic
RUN mkdir -p /package/lib/
RUN ldd $(which shellcheck) | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /package/lib/
# Copy shellcheck package out to mounted directory
CMD ["cp", "-avr", "/package", "/mnt/"]