Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Commit

Permalink
consolidated container build script. polised run script
Browse files Browse the repository at this point in the history
  • Loading branch information
Li Lin committed Jan 29, 2015
1 parent e97c924 commit a63833e
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 100 deletions.
15 changes: 0 additions & 15 deletions atl-bamboo/build.sh

This file was deleted.

15 changes: 0 additions & 15 deletions atl-fisheye/build.sh

This file was deleted.

15 changes: 0 additions & 15 deletions atl-jira/build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions atl-postgres/build.sh

This file was deleted.

16 changes: 0 additions & 16 deletions atl-stash/build.sh

This file was deleted.

4 changes: 2 additions & 2 deletions atl-web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM httpd:2.4
MAINTAINER Li Lin <[email protected]>

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/

2 changes: 0 additions & 2 deletions atl-web/build.sh

This file was deleted.

49 changes: 28 additions & 21 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion java-base/build.sh

This file was deleted.

18 changes: 7 additions & 11 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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 \
Expand All @@ -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

Expand Down Expand Up @@ -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

;;

Expand Down

0 comments on commit a63833e

Please sign in to comment.