From cb791cab290013bf6d9b51389c4b7cd443df18c4 Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Thu, 22 Oct 2015 02:13:39 -0700 Subject: [PATCH] add circleci Signed-off-by: Jessica Frazelle --- README.md | 4 ++- circle.yml | 7 ++++++ couchpotato/Dockerfile | 1 + sickbeard/Dockerfile | 1 + test.sh | 48 ++++++++++++++++++++++++++++++++++++ tor-browser/alpha/Dockerfile | 2 +- 6 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 circle.yml create mode 100755 test.sh diff --git a/README.md b/README.md index 7204d4c..ba93e8a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ ## dockerfiles +[![Circle CI](https://circleci.com/gh/jfrazelle/dockerfiles.svg?style=svg)](https://circleci.com/gh/jfrazelle/dockerfiles) + This is a repo to hold various Dockerfiles for images I create. -I try to make sure each has a command at the top for running it, +I try to make sure each has a command at the top for running it, if a file you are looking at does not have a command, please pull request it! diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..92bb99b --- /dev/null +++ b/circle.yml @@ -0,0 +1,7 @@ +machine: + services: + - docker + +test: + override: + - ./test.sh diff --git a/couchpotato/Dockerfile b/couchpotato/Dockerfile index 5d36821..14ab24e 100644 --- a/couchpotato/Dockerfile +++ b/couchpotato/Dockerfile @@ -5,6 +5,7 @@ # -p 5050:5050 \ # -v /etc/localtime:/etc/localtime:ro \ # -v /volumes/couchpotato:/data \ +# --link transmission:transmission \ # --name couchpotato \ # jess/couchpotato # diff --git a/sickbeard/Dockerfile b/sickbeard/Dockerfile index bacbbd1..bd4b100 100644 --- a/sickbeard/Dockerfile +++ b/sickbeard/Dockerfile @@ -5,6 +5,7 @@ # -p 8081:8081 \ # -v /etc/localtime:/etc/localtime:ro \ # -v /volumes/sickbeard:/data \ +# --link transmission:transmission \ # --name sickbeard \ # jess/sickbeard # diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..67d0e34 --- /dev/null +++ b/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -e + +# this is kind of an expensive check, so let's not do this twice if we +# are running more than one validate bundlescript +VALIDATE_REPO='https://github.com/jfrazelle/dockerfiles.git' +VALIDATE_BRANCH='master' + +VALIDATE_HEAD="$(git rev-parse --verify HEAD)" + +git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH" +VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)" + +VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD" + +validate_diff() { + if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then + git diff "$VALIDATE_COMMIT_DIFF" "$@" + else + git diff HEAD~ "$@" + fi +} + +# get the dockerfiles changed +IFS=$'\n' +files=( $(validate_diff --name-only -- '*Dockerfile') ) +unset IFS + +# build the changed dockerfiles +for f in "${files[@]}"; do + image=${f%Dockerfile} + base=${image%%\/*} + suite=${image##*\/} + build_dir=$(dirname $f) + + if [[ -z "$suite" ]]; then + suite=latest + fi + + ( + set -x + docker build -t ${base}:${suite} ${build_dir} + ) + + echo " --- " + echo "Successfully built ${base}:${suite} with context ${build_dir}" + echo " --- " +done diff --git a/tor-browser/alpha/Dockerfile b/tor-browser/alpha/Dockerfile index 57ab195..7b19575 100644 --- a/tor-browser/alpha/Dockerfile +++ b/tor-browser/alpha/Dockerfile @@ -3,7 +3,7 @@ # docker run -v /tmp/.X11-unix:/tmp/.X11-unix \ # -v /dev/snd:/dev/snd \ # -e DISPLAY=unix$DISPLAY \ -# jess/tor-browser +# jess/tor-browser:alpha # FROM debian:jessie MAINTAINER Jessica Frazelle