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=========================================================
22 # Script to build a Docker file for the PDP simulator. The docker image
23 # generated by this script should NOT be placed in the ONAP nexus, it is
24 # only for testing purposes.
27 if [ -z "$PDP_SIM_HOME" ]
32 # Check for the dockerfile
33 if [ ! -f "$PDP_SIM_HOME/src/main/package/docker/Dockerfile" ]
35 echo docker file "$PDP_SIM_HOME/src/main/package/docker/Dockerfile" not found
39 # Check for the start script
40 if [ ! -f "$PDP_SIM_HOME/src/main/package/docker/pdp-sim.sh" ]
42 echo start script "$PDP_SIM_HOME/src/main/package/docker/pdp-sim.sh" not found
46 # Check for the tarball
47 tarball_count=`ls $PDP_SIM_HOME/target/policy-models-sim-pdp-*tarball.tar.gz 2> /dev/null | wc | awk '{print $1}'`
48 if [ "$tarball_count" -ne "1" ]
50 echo one and only one tarball should exist in the target directory
54 # Set up the docker build
55 rm -fr $PDP_SIM_HOME/target/docker
56 mkdir $PDP_SIM_HOME/target/docker
57 cp $PDP_SIM_HOME/src/main/package/docker/Dockerfile $PDP_SIM_HOME/target/docker
58 cp $PDP_SIM_HOME/src/main/package/docker/pdp-sim.sh $PDP_SIM_HOME/target/docker
59 cp $PDP_SIM_HOME/target/policy-models-sim-pdp-*tarball.tar.gz $PDP_SIM_HOME/target/docker/policy-models-sim-pdp-tarball.tar.gz
61 # Run the docker build
62 cd $PDP_SIM_HOME/target
63 docker build -t pdp/simulator docker