diff --git a/atl-bamboo/build.sh b/atl-bamboo/build.sh deleted file mode 100755 index ec90065..0000000 --- a/atl-bamboo/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -o errexit - -TAG="sloppycoder/atl-bamboo" - -docker build --rm --tag ${TAG}:latest . - -VERSION_STRING=`docker inspect -f '{{ index .ContainerConfig.Env 2 }}' ${TAG}:latest ` -VERSION=`echo $VERSION_STRING | awk ' { match($0, ".*=(.*)", a) } END { print a[1] }' ` - -if [ ! -z "$VERSION" ]; then - echo tagging $VERSION - docker tag ${TAG}:latest ${TAG}:${VERSION} -fi diff --git a/atl-fisheye/build.sh b/atl-fisheye/build.sh deleted file mode 100755 index bddfa5d..0000000 --- a/atl-fisheye/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -o errexit - -TAG="sloppycoder/atl-fisheye" - -docker build --rm --tag ${TAG}:latest . - -VERSION_STRING=`docker inspect -f '{{ index .ContainerConfig.Env 2 }}' ${TAG}:latest ` -VERSION=`echo $VERSION_STRING | awk ' { match($0, ".*=(.*)", a) } END { print a[1] }' ` - -if [ ! -z "$VERSION" ]; then - echo tagging $VERSION - docker tag ${TAG}:latest ${TAG}:${VERSION} -fi diff --git a/atl-jira/build.sh b/atl-jira/build.sh deleted file mode 100755 index 2cf33a8..0000000 --- a/atl-jira/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -o errexit - -TAG="sloppycoder/atl-jira" - -docker build --rm --tag ${TAG}:latest . - -VERSION_STRING=`docker inspect -f '{{ index .ContainerConfig.Env 2 }}' ${TAG}:latest ` -VERSION=`echo $VERSION_STRING | awk ' { match($0, ".*=(.*)", a) } END { print a[1] }' ` - -if [ ! -z "$VERSION" ]; then - echo tagging $VERSION - docker tag ${TAG}:latest ${TAG}:${VERSION} -fi diff --git a/atl-postgres/build.sh b/atl-postgres/build.sh deleted file mode 100755 index b05719b..0000000 --- a/atl-postgres/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -TAG="sloppycoder/atl-postgres" -docker build --rm --tag ${TAG}:latest . diff --git a/atl-stash/build.sh b/atl-stash/build.sh deleted file mode 100755 index a018395..0000000 --- a/atl-stash/build.sh +++ /dev/null @@ -1,16 +0,0 @@ - -#!/bin/bash - -set -o errexit - -TAG="sloppycoder/atl-stash" - -docker build --rm --tag ${TAG}:latest . - -VERSION_STRING=`docker inspect -f '{{ index .ContainerConfig.Env 2 }}' ${TAG}:latest ` -VERSION=`echo $VERSION_STRING | awk ' { match($0, ".*=(.*)", a) } END { print a[1] }' ` - -if [ ! -z "$VERSION" ]; then - echo tagging $VERSION - docker tag ${TAG}:latest ${TAG}:${VERSION} -fi diff --git a/atl-web/Dockerfile b/atl-web/Dockerfile index b1388f9..b80ff0e 100644 --- a/atl-web/Dockerfile +++ b/atl-web/Dockerfile @@ -2,6 +2,6 @@ FROM httpd:2.4 MAINTAINER Li Lin RUN mv /usr/local/apache2/conf/httpd.conf httpd.conf.orig -ADD httpd.conf /usr/local/apache2/conf/httpd.conf -ADD proxy-atl.conf /usr/local/apache2/conf/extra/proxy-atl.conf +ADD httpd.conf /usr/local/apache2/conf/ +ADD proxy-atl.conf /usr/local/apache2/conf/extra/ diff --git a/atl-web/build.sh b/atl-web/build.sh deleted file mode 100755 index c0adffc..0000000 --- a/atl-web/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -TAG="sloppycoder/atl-web" -docker build --rm --tag ${TAG}:latest . diff --git a/build.sh b/build.sh index 148e64c..f6f5be2 100755 --- a/build.sh +++ b/build.sh @@ -1,29 +1,36 @@ -cd java-base -./build.sh -cd .. +#!/bin/bash -cd atl-jira -./build.sh -cd .. +set -o errexit -cd atl-stash -./build.sh -cd .. +# build all the images -cd atl-fisheye -./build.sh -cd .. +( + cd java-base + #docker build --rm --tag sloppycoder/java-base . +) -cd atl-bamboo -./build.sh -cd .. +for MODULE in $(ls -d atl-bamboo*) +do +( + echo building $MODULE + cd $MODULE + TAG="sloppycoder/$MODULE" -cd atl-postgres -./build.sh -cd .. + docker build --rm --tag ${TAG}:latest . + case "$MODULE" in -cd atl-web -./build.sh -cd .. + atl-jira|atl-stash|atl-bamboo|atl-fisheye) + ENV_STRING="$(docker inspect -f '{{ index .ContainerConfig.Env 2 }}' ${TAG}:latest )" + VERSION="$(echo $ENV_STRING | awk ' { match($0, ".*=(.*)", a) } END { print a[1] }')" + + [ -z "$VERSION" ] || docker tag ${TAG}:latest ${TAG}:${VERSION} + ;; + + *) + + ;; + esac +) +done diff --git a/java-base/build.sh b/java-base/build.sh deleted file mode 100755 index ff8d248..0000000 --- a/java-base/build.sh +++ /dev/null @@ -1 +0,0 @@ -docker build --rm --tag sloppycoder/java-base . diff --git a/run.sh b/run.sh index 2d8219f..e17f750 100755 --- a/run.sh +++ b/run.sh @@ -36,7 +36,7 @@ echo " is_container_running() { - if [ "`docker inspect -f '{{ .State.Running }}' $1 2> /dev/null `" = "true" ]; then + if [ "$(docker inspect -f '{{ .State.Running }}' $1 2> /dev/null)" = "true" ]; then return 1 else return 0 @@ -47,17 +47,13 @@ is_container_running() { stop_and_rm_container() { is_container_running $1 || docker stop $1 - (docker ps -a | grep $1 > /dev/null) && docker rm $1 + ( docker ps -a | grep -q $1 ) && docker rm $1 } start_app() { - if [ "$2" = "-i" ]; then - RUN_MODE="-it" - else - RUN_MODE="-d" - fi + [ "$2" = "-i" ] && RUN_MODE="-it" || RUN_MODE="-d" stop_and_rm_container $1 @@ -81,7 +77,7 @@ start_db() { start_data() { - (docker ps -a | grep atldata > /dev/null) || \ + (docker ps -a | grep -q atldata ) || \ docker run --name atldata \ -v /opt/atlassian-home \ -v /var/lib/postgresql/data \ @@ -102,13 +98,13 @@ start_web() { $LINKS \ ${DOCKER_HUB_USER}/atl-web - test -z "$LINKS" && echo httpd started but no application running. + [ -z "$LINKS" ] && echo httpd started but no application running. } ACTION=$1 -test -z "$ACTION" && ACTION=all +[ -z "$ACTION" ] && ACTION=all case "$ACTION" in @@ -146,7 +142,7 @@ case "$ACTION" in stop_and_rm_container $1 start_app $1 $2 $3 $4 - test -z "$2" && start_web + [ -z "$2" ] && start_web ;;