blob: 2b6c006c52e4bf6cc292b31b8adbd214ef28274c [file] [log] [blame]
Sai Gandham67a6d892018-10-10 04:31:59 -05001#!/bin/bash
2#
3# Docker Building Script. Reads all the components generated by install, on per-version basis
4#
5# Pull in Variables from d.props
6if [ ! -e ./d.props ]; then
7 cp d.props.init d.props
8fi
9
10. ./d.props
11
12DOCKER=${DOCKER:=docker}
13
14echo "Building Containers for aaf components, version $VERSION"
15
16# AAF_cass now needs a version...
17cd ../auth-cass/docker
18bash ./dbuild.sh
19cd -
20
21# Create the AAF Config (Security) Images
22cd ..
23cp ../cadi/aaf/target/aaf-cadi-aaf-${VERSION}-full.jar sample/bin
24cp -Rf ../conf/CA sample
25
26# AAF Config image (for AAF itself)
27sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' docker/Dockerfile.config > sample/Dockerfile
28$DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample
29$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION}
30$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/latest
31
32# AAF Agent Image (for Clients)
33sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' docker/Dockerfile.client > sample/Dockerfile
34$DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample
35$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION}
36$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:latest
37
38# Clean up
39rm sample/Dockerfile sample/bin/aaf-cadi-aaf-${VERSION}-full.jar
40rm -Rf sample/CA
41cd -
42
43########
44# Second, build a core Docker Image
45echo Building aaf_$AAF_COMPONENT...
46# Apply currrent Properties to Docker file, and put in place.
47sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.core >../aaf_${VERSION}/Dockerfile
48cd ..
49$DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION}
50$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:${VERSION}
51$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:latest
52rm aaf_${VERSION}/Dockerfile
53cd -
54
55if ["$1" == ""]; then
56 AAF_COMPONENTS=$(ls ../aaf_*HOT/bin | grep -v '\.')
57else
58 AAF_COMPONENTS=$1
59fi
60
61mkdir -p ../aaf_${VERSION}/pod
62cp ../sample/bin/pod_wait.sh ../aaf_${VERSION}/pod
63for AAF_COMPONENT in ${AAF_COMPONENTS}; do
64 echo Building aaf_$AAF_COMPONENT...
65 sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.ms >../aaf_${VERSION}/Dockerfile
66 cd ..
67 $DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION}
68 $DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
69 $DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:latest
70 rm aaf_${VERSION}/Dockerfile
71 cd -
72done
73rm ../aaf_${VERSION}/pod/*
74rmdir ../aaf_${VERSION}/pod