blob: 3f9bfdaf4c6efe27494ad2fa1111a139fe0d9a96 [file] [log] [blame]
Instrumental4ad47632018-07-13 15:49:26 -05001#!/bin/bash
Instrumental7a1817b2018-11-05 11:11:15 -06002#########
3# ============LICENSE_START====================================================
4# org.onap.aaf
5# ===========================================================================
6# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7# ===========================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19# ============LICENSE_END====================================================
Sai Gandham66118342018-04-04 15:33:05 -050020#
21# Docker Building Script. Reads all the components generated by install, on per-version basis
22#
Instrumental924b18d2018-04-05 20:17:18 -050023# Pull in Variables from d.props
Instrumental9ec28952018-07-12 11:14:10 -050024if [ ! -e ./d.props ]; then
Instrumental4ad47632018-07-13 15:49:26 -050025 cp d.props.init d.props
Instrumental9ec28952018-07-12 11:14:10 -050026fi
27
Instrumentalf482ea02018-04-10 15:03:24 -050028. ./d.props
Instrumental9ec28952018-07-12 11:14:10 -050029
Instrumental94053612018-10-08 11:27:18 -050030DOCKER=${DOCKER:=docker}
31
Instrumentalbc299c02018-09-25 06:42:31 -050032echo "Building Containers for aaf components, version $VERSION"
33
Instrumental3019a282018-09-25 16:05:20 -050034# AAF_cass now needs a version...
Instrumental3505a522019-01-31 14:49:24 -060035cd ../auth-cass/docker
36bash ./dbuild.sh
37cd -
Instrumental12414fe2019-01-22 10:27:32 -060038
39# AAF Base version - set the core image, etc
40sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
Instrumental628b7102019-02-15 19:40:04 -060041 -e 's/${DUSER}/'${DUSER}'/g' \
Instrumental12414fe2019-01-22 10:27:32 -060042 Dockerfile.base > Dockerfile
43$DOCKER build -t ${ORG}/${PROJECT}/aaf_base:${VERSION} .
44$DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:${VERSION}
45$DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:latest
46rm Dockerfile
Instrumental3019a282018-09-25 16:05:20 -050047
Instrumental32cdd552018-07-19 13:29:32 -050048# Create the AAF Config (Security) Images
Instrumental9ec28952018-07-12 11:14:10 -050049cd ..
Instrumental9fe11532018-10-23 17:40:47 -050050cp auth-cmd/target/aaf-auth-cmd-$VERSION-full.jar sample/bin
Instrumentale2fa0e62019-02-07 11:09:32 -060051cp auth-batch/target/aaf-auth-batch-$VERSION-full.jar sample/bin
Instrumentalbc299c02018-09-25 06:42:31 -050052cp -Rf ../conf/CA sample
Instrumental32cdd552018-07-19 13:29:32 -050053
Instrumental12414fe2019-01-22 10:27:32 -060054
Instrumental32cdd552018-07-19 13:29:32 -050055# AAF Config image (for AAF itself)
Instrumental12414fe2019-01-22 10:27:32 -060056sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
57 -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
58 -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
Instrumental628b7102019-02-15 19:40:04 -060059 -e 's/${DUSER}/'${DUSER}'/g' \
Instrumental12414fe2019-01-22 10:27:32 -060060 docker/Dockerfile.config > sample/Dockerfile
Instrumental94053612018-10-08 11:27:18 -050061$DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample
62$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION}
Instrumental3505a522019-01-31 14:49:24 -060063$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:latest
Instrumental32cdd552018-07-19 13:29:32 -050064
Instrumental93871ff2018-10-15 07:37:28 -050065cp ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar sample/bin
Instrumental32cdd552018-07-19 13:29:32 -050066# AAF Agent Image (for Clients)
Instrumental12414fe2019-01-22 10:27:32 -060067sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
68 -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
69 -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
Instrumental628b7102019-02-15 19:40:04 -060070 -e 's/${DUSER}/'${DUSER}'/g' \
Instrumental12414fe2019-01-22 10:27:32 -060071 docker/Dockerfile.client > sample/Dockerfile
Instrumental94053612018-10-08 11:27:18 -050072$DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample
73$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION}
74$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:latest
Instrumental32cdd552018-07-19 13:29:32 -050075
76# Clean up
Instrumentale2fa0e62019-02-07 11:09:32 -060077rm sample/Dockerfile sample/bin/aaf-*-${VERSION}-full.jar sample/bin/aaf-cadi-servlet-sample-${VERSION}-sample.jar
Instrumentalbc299c02018-09-25 06:42:31 -050078rm -Rf sample/CA
Instrumental9ec28952018-07-12 11:14:10 -050079cd -
Instrumental365638c2018-10-01 15:26:03 -050080
Instrumental32cdd552018-07-19 13:29:32 -050081########
Instrumental9ec28952018-07-12 11:14:10 -050082# Second, build a core Docker Image
83echo Building aaf_$AAF_COMPONENT...
84# Apply currrent Properties to Docker file, and put in place.
Instrumental12414fe2019-01-22 10:27:32 -060085sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
86 -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
87 -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
Instrumental628b7102019-02-15 19:40:04 -060088 -e 's/${DUSER}/'${DUSER}'/g' \
Instrumental12414fe2019-01-22 10:27:32 -060089 Dockerfile.core >../aaf_${VERSION}/Dockerfile
Instrumental9ec28952018-07-12 11:14:10 -050090cd ..
Instrumental94053612018-10-08 11:27:18 -050091$DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION}
92$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:${VERSION}
93$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:latest
Instrumental9ec28952018-07-12 11:14:10 -050094rm aaf_${VERSION}/Dockerfile
95cd -
Sai Gandham66118342018-04-04 15:33:05 -050096
Instrumental93871ff2018-10-15 07:37:28 -050097#######
98# Do all the Containers related to AAF Services
99#######
Sai Gandham66118342018-04-04 15:33:05 -0500100if ["$1" == ""]; then
Instrumental93871ff2018-10-15 07:37:28 -0500101 AAF_COMPONENTS=$(ls ../aaf_${VERSION}/bin | grep -v '\.')
Sai Gandham66118342018-04-04 15:33:05 -0500102else
Instrumental4ad47632018-07-13 15:49:26 -0500103 AAF_COMPONENTS=$1
Sai Gandham66118342018-04-04 15:33:05 -0500104fi
105
Instrumental12414fe2019-01-22 10:27:32 -0600106cp ../sample/bin/pod_wait.sh ../aaf_${VERSION}/bin
Sai Gandham66118342018-04-04 15:33:05 -0500107for AAF_COMPONENT in ${AAF_COMPONENTS}; do
Instrumental4ad47632018-07-13 15:49:26 -0500108 echo Building aaf_$AAF_COMPONENT...
Instrumental12414fe2019-01-22 10:27:32 -0600109 sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
110 -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
111 -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
Instrumental628b7102019-02-15 19:40:04 -0600112 -e 's/${DUSER}/'${DUSER}'/g' \
Instrumental12414fe2019-01-22 10:27:32 -0600113 Dockerfile.ms >../aaf_${VERSION}/Dockerfile
Instrumental4ad47632018-07-13 15:49:26 -0500114 cd ..
Instrumental94053612018-10-08 11:27:18 -0500115 $DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION}
116 $DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
117 $DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:latest
Instrumental4ad47632018-07-13 15:49:26 -0500118 rm aaf_${VERSION}/Dockerfile
119 cd -
Instrumental93871ff2018-10-15 07:37:28 -0500120
Sai Gandham66118342018-04-04 15:33:05 -0500121done
Instrumental12414fe2019-01-22 10:27:32 -0600122rm ../aaf_${VERSION}/bin/pod_wait.sh