Test Dockerfiles and Travis CI on downstream repos
This commit is contained in:
parent
87481dce25
commit
32689ef5eb
|
@ -0,0 +1,19 @@
|
||||||
|
sudo: required
|
||||||
|
|
||||||
|
language: sh
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- export DOCKER_REPO=nlknguyen/shellcheck
|
||||||
|
- export TAG=$(if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi)
|
||||||
|
|
||||||
|
script:
|
||||||
|
- docker build -t builder -f Dockerfile_builder .
|
||||||
|
- docker run --rm -it -v $(pwd):/mnt builder
|
||||||
|
- docker build -t $DOCKER_REPO:$TAG .
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||||
|
- docker push $DOCKER_REPO:$TAG
|
25
Dockerfile
25
Dockerfile
|
@ -1,22 +1,11 @@
|
||||||
FROM ubuntu:xenial
|
FROM alpine:latest
|
||||||
MAINTAINER https://github.com/koalaman/shellcheck
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
MAINTAINER Nikyle Nguyen <NLKNguyen@MSN.com>
|
||||||
cabal-install \
|
|
||||||
ghc \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY ShellCheck.cabal /src/ShellCheck.cabal
|
COPY package/bin/shellcheck /usr/local/bin/
|
||||||
|
COPY package/lib/ /usr/local/lib/
|
||||||
|
|
||||||
WORKDIR /src
|
RUN ldconfig /usr/local/lib
|
||||||
|
|
||||||
ENV PATH="/root/.cabal/bin:$PATH"
|
WORKDIR /mnt
|
||||||
|
ENTRYPOINT ["shellcheck"]
|
||||||
RUN cabal update \
|
|
||||||
&& cabal install --only-dependencies
|
|
||||||
|
|
||||||
COPY . /src
|
|
||||||
|
|
||||||
RUN cabal install /src
|
|
||||||
|
|
||||||
CMD ["shellcheck", "-"]
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
FROM mitchty/alpine-ghc:latest
|
||||||
|
|
||||||
|
MAINTAINER Nikyle Nguyen <NLKNguyen@MSN.com>
|
||||||
|
|
||||||
|
RUN apk add --no-cache build-base
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/src/shellcheck
|
||||||
|
WORKDIR /usr/src/shellcheck
|
||||||
|
|
||||||
|
# # ------------------------------------------------------------
|
||||||
|
# # Build & Test
|
||||||
|
# # ------------------------------------------------------------
|
||||||
|
|
||||||
|
# Obtain the dependencies first, which are less likely to change, in order to reduce
|
||||||
|
# subsequent build time by leveraging image cache. This benefits developers when they
|
||||||
|
# build their code with this image locally. In case of Travis CI, this doesn't help
|
||||||
|
# reduce building time because Travis CI doesn't use cache.
|
||||||
|
COPY ShellCheck.cabal .
|
||||||
|
RUN cabal update && cabal install --only-dependencies
|
||||||
|
|
||||||
|
# Copy the rest of the source files, including ShellCheck.cabal again but doesn't matter
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build
|
||||||
|
RUN cabal install
|
||||||
|
|
||||||
|
# TODO: run tests
|
||||||
|
|
||||||
|
# # ------------------------------------------------------------
|
||||||
|
# # Set PATH
|
||||||
|
# # ------------------------------------------------------------
|
||||||
|
|
||||||
|
# Add runtime path to easily reach the executable file. This only exists during build.
|
||||||
|
ENV PATH "/root/.cabal/bin:$PATH"
|
||||||
|
|
||||||
|
# Make it permanent for someone who login to the container of this image
|
||||||
|
RUN echo "export PATH=${PATH}" >> /etc/profile
|
||||||
|
|
||||||
|
# # ------------------------------------------------------------
|
||||||
|
# # Extract Binaries
|
||||||
|
# # ------------------------------------------------------------
|
||||||
|
|
||||||
|
# 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/"]
|
Loading…
Reference in New Issue