3 # ============LICENSE_START=======================================================
4 # Copyright (C) 2019 Nordix Foundation.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
23 # Script to build a Docker file for the DMaaP simulator. The docker image
24 # generated by this script should NOT be placed in the ONAP nexus, it is
25 # only for testing purposes.
28 if [ -z "$DMAAP_SIM_HOME" ]
33 # Check for the dockerfile
34 if [ ! -f "$DMAAP_SIM_HOME/src/main/package/docker/Dockerfile" ]
36 echo docker file "$DMAAP_SIM_HOME/src/main/package/docker/Dockerfile" not found
40 # Check for the start script
41 if [ ! -f "$DMAAP_SIM_HOME/src/main/package/docker/dmaap-sim.sh" ]
43 echo start script "$DMAAP_SIM_HOME/src/main/package/docker/dmaap-sim.sh" not found
47 # Check for the tarball
48 tarball_count=`ls $DMAAP_SIM_HOME/target/policy-models-sim-dmaap-*-SNAPSHOT-tarball.tar.gz 2> /dev/null | wc | awk '{print $1}'`
49 if [ "$tarball_count" -ne "1" ]
51 echo one and only one tarball should exist in the target directory
55 # Set up the docker build
56 rm -fr $DMAAP_SIM_HOME/target/docker
57 mkdir $DMAAP_SIM_HOME/target/docker
58 cp $DMAAP_SIM_HOME/src/main/package/docker/Dockerfile $DMAAP_SIM_HOME/target/docker
59 cp $DMAAP_SIM_HOME/src/main/package/docker/dmaap-sim.sh $DMAAP_SIM_HOME/target/docker
60 cp $DMAAP_SIM_HOME/target/policy-models-sim-dmaap-*-SNAPSHOT-tarball.tar.gz $DMAAP_SIM_HOME/target/docker/policy-models-sim-dmaap-tarball.tar.gz
62 # Run the docker build
63 cd $DMAAP_SIM_HOME/target
64 docker build -t dmaap/simulator docker