3 # ============LICENSE_START=======================================================
5 # ================================================================================
6 # Copyright (C) 2020 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
12 # http://www.apache.org/licenses/LICENSE-2.0
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.
20 # SPDX-License-Identifier: Apache-2.0
21 # ============LICENSE_END=========================================================
25 # Script to build a Docker file for the simulators. The docker image
26 # generated by this script should NOT be placed in the ONAP nexus, it is
27 # only for testing purposes.
30 if [ -z "$SIMULATOR_HOME" ]
35 # Check for the dockerfile
36 if [ ! -f "$SIMULATOR_HOME/src/main/package/docker/Dockerfile" ]
38 echo docker file "$SIMULATOR_HOME/src/main/package/docker/Dockerfile" not found
42 # Check for the start script
43 if [ ! -f "$SIMULATOR_HOME/src/main/package/docker/simulators.sh" ]
45 echo start script "$SIMULATOR_HOME/src/main/package/docker/simulators.sh" not found
49 # Check for the tarball
50 tarball_count=`ls $SIMULATOR_HOME/target/policy-models-simulators-*tarball.tar.gz 2> /dev/null | wc | awk '{print $1}'`
51 if [ "$tarball_count" -ne "1" ]
53 echo one and only one tarball should exist in the target directory
57 # Set up the docker build
58 rm -fr $SIMULATOR_HOME/target/docker
59 mkdir $SIMULATOR_HOME/target/docker
60 cp $SIMULATOR_HOME/src/main/package/docker/Dockerfile $SIMULATOR_HOME/target/docker
61 cp $SIMULATOR_HOME/src/main/package/docker/simulators.sh $SIMULATOR_HOME/target/docker
62 cp $SIMULATOR_HOME/target/policy-models-simulators-*tarball.tar.gz \
63 $SIMULATOR_HOME/target/docker/policy-models-simulators-tarball.tar.gz
65 # Run the docker build
66 cd $SIMULATOR_HOME/target
67 docker build -t policy/simulators docker