561db1986f76a550fb34320d5549d3ebee9676ec
[optf/osdf.git] / test / functest / simulators / build_sim_image.sh
1 #!/bin/bash
2 #
3 # -------------------------------------------------------------------------
4 #   Copyright (c) 2018 AT&T Intellectual Property
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
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17 #
18 # -------------------------------------------------------------------------
19 #
20
21 if [[ `uname` == "Darwin" ]]
22 then
23   SCRIPTDIR=$(dirname $(greadlink -f $0))
24 else
25   SCRIPTDIR=$(dirname $(readlink -f $0))
26 fi
27
28 FUNC_TEST_DIR=$(dirname $SCRIPTDIR)
29 TEST_DIR=$(dirname $FUNC_TEST_DIR)
30 SIMULATORS_DIR=$FUNC_TEST_DIR/simulators
31 OSDF_DIR=$(dirname $TEST_DIR)
32 DOCKER_DIR=$SIMULATORS_DIR/tmp_docker
33
34 echo "Before Docker Build"
35 cat $OSDF_DIR/requirements-sim.txt
36 echo $OSDF_DIR
37
38 mkdir -p $DOCKER_DIR/sim/osdf/policy/response-payloads/pdp-has-vcpe-good
39
40 cp $SIMULATORS_DIR/Dockerfile $DOCKER_DIR/.
41
42 cp -r $OSDF_DIR/osdf $DOCKER_DIR/sim
43 mkdir -p $DOCKER_DIR/sim/config/
44 cp $SIMULATORS_DIR/simulated-config/*.yaml $DOCKER_DIR/sim/config/
45 cp $SIMULATORS_DIR/simulated-config/*.yml $DOCKER_DIR/sim/config/
46 cp $SIMULATORS_DIR/simulated-config/*.config $DOCKER_DIR/sim/config/
47 cp -r $SIMULATORS_DIR/configdb $DOCKER_DIR/sim
48 cp -r $SIMULATORS_DIR/has-api $DOCKER_DIR/sim
49 cp -r $SIMULATORS_DIR/policy $DOCKER_DIR/sim
50 cp -r $SIMULATORS_DIR/aai $DOCKER_DIR/sim
51 cp $TEST_DIR/policy-local-files/*.json $DOCKER_DIR/sim/policy/response-payloads/pdp-has-vcpe-good
52 cp $TEST_DIR/placement-tests/policy_response.json $DOCKER_DIR/sim/policy/response-payloads/
53 cp $SIMULATORS_DIR/oof_dependencies_simulators.py $DOCKER_DIR/sim/oof_dependencies_simulators.py
54 cp $OSDF_DIR/requirements-sim.txt $DOCKER_DIR/requirements.txt
55 cp -r $SIMULATORS_DIR/start_sim.sh $DOCKER_DIR/
56
57 cd $DOCKER_DIR
58
59 docker build -t osdf_sim .
60
61 rm -rf $DOCKER_DIR