Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Instrumental | 7a1817b | 2018-11-05 11:11:15 -0600 | [diff] [blame] | 2 | ######### |
| 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 Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 20 | # |
| 21 | # Docker Building Script. Reads all the components generated by install, on per-version basis |
| 22 | # |
Instrumental | 924b18d | 2018-04-05 20:17:18 -0500 | [diff] [blame] | 23 | # Pull in Variables from d.props |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 24 | if [ ! -e ./d.props ]; then |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 25 | cp d.props.init d.props |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 26 | fi |
| 27 | |
Instrumental | f482ea0 | 2018-04-10 15:03:24 -0500 | [diff] [blame] | 28 | . ./d.props |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 29 | |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 30 | DOCKER=${DOCKER:=docker} |
| 31 | |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 32 | echo "Building Containers for aaf components, version $VERSION" |
| 33 | |
Instrumental | 3019a28 | 2018-09-25 16:05:20 -0500 | [diff] [blame] | 34 | # AAF_cass now needs a version... |
Instrumental | 3505a52 | 2019-01-31 14:49:24 -0600 | [diff] [blame] | 35 | cd ../auth-cass/docker |
| 36 | bash ./dbuild.sh |
| 37 | cd - |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 38 | |
| 39 | # AAF Base version - set the core image, etc |
| 40 | sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ |
| 41 | Dockerfile.base > Dockerfile |
| 42 | $DOCKER build -t ${ORG}/${PROJECT}/aaf_base:${VERSION} . |
| 43 | $DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:${VERSION} |
| 44 | $DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:latest |
| 45 | rm Dockerfile |
Instrumental | 3019a28 | 2018-09-25 16:05:20 -0500 | [diff] [blame] | 46 | |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 47 | # Create the AAF Config (Security) Images |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 48 | cd .. |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 49 | cp auth-cmd/target/aaf-auth-cmd-$VERSION-full.jar sample/bin |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 50 | cp -Rf ../conf/CA sample |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 51 | |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 52 | |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 53 | # AAF Config image (for AAF itself) |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 54 | sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ |
| 55 | -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ |
| 56 | -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ |
| 57 | docker/Dockerfile.config > sample/Dockerfile |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 58 | $DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample |
| 59 | $DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION} |
Instrumental | 3505a52 | 2019-01-31 14:49:24 -0600 | [diff] [blame] | 60 | $DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:latest |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 61 | |
Instrumental | 93871ff | 2018-10-15 07:37:28 -0500 | [diff] [blame] | 62 | cp ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar sample/bin |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 63 | # AAF Agent Image (for Clients) |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 64 | sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ |
| 65 | -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ |
| 66 | -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ |
| 67 | docker/Dockerfile.client > sample/Dockerfile |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 68 | $DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample |
| 69 | $DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION} |
| 70 | $DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:latest |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 71 | |
| 72 | # Clean up |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 73 | rm sample/Dockerfile sample/bin/aaf-auth-cmd-${VERSION}-full.jar sample/bin/aaf-cadi-servlet-sample-${VERSION}-sample.jar |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 74 | rm -Rf sample/CA |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 75 | cd - |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 76 | |
Instrumental | 32cdd55 | 2018-07-19 13:29:32 -0500 | [diff] [blame] | 77 | ######## |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 78 | # Second, build a core Docker Image |
| 79 | echo Building aaf_$AAF_COMPONENT... |
| 80 | # Apply currrent Properties to Docker file, and put in place. |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 81 | sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ |
| 82 | -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ |
| 83 | -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ |
| 84 | Dockerfile.core >../aaf_${VERSION}/Dockerfile |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 85 | cd .. |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 86 | $DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION} |
| 87 | $DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:${VERSION} |
| 88 | $DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:latest |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 89 | rm aaf_${VERSION}/Dockerfile |
| 90 | cd - |
Sai Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 91 | |
Instrumental | 93871ff | 2018-10-15 07:37:28 -0500 | [diff] [blame] | 92 | ####### |
| 93 | # Do all the Containers related to AAF Services |
| 94 | ####### |
Sai Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 95 | if ["$1" == ""]; then |
Instrumental | 93871ff | 2018-10-15 07:37:28 -0500 | [diff] [blame] | 96 | AAF_COMPONENTS=$(ls ../aaf_${VERSION}/bin | grep -v '\.') |
Sai Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 97 | else |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 98 | AAF_COMPONENTS=$1 |
Sai Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 99 | fi |
| 100 | |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 101 | cp ../sample/bin/pod_wait.sh ../aaf_${VERSION}/bin |
Sai Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 102 | for AAF_COMPONENT in ${AAF_COMPONENTS}; do |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 103 | echo Building aaf_$AAF_COMPONENT... |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 104 | sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ |
| 105 | -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ |
| 106 | -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ |
| 107 | Dockerfile.ms >../aaf_${VERSION}/Dockerfile |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 108 | cd .. |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 109 | $DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION} |
| 110 | $DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} |
| 111 | $DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:latest |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 112 | rm aaf_${VERSION}/Dockerfile |
| 113 | cd - |
Instrumental | 93871ff | 2018-10-15 07:37:28 -0500 | [diff] [blame] | 114 | |
Sai Gandham | 6611834 | 2018-04-04 15:33:05 -0500 | [diff] [blame] | 115 | done |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 116 | rm ../aaf_${VERSION}/bin/pod_wait.sh |