Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ======================================================================== |
| 3 | # Copyright (c) 2018 Orange |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # ======================================================================== |
| 16 | |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 17 | echo "This is ${WORKSPACE}/scripts/externalapi-nbi/delete_nbi_containers.sh" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 18 | |
| 19 | # Check if docker-compose file exists |
| 20 | if [ ! -f "$WORKSPACE/externalapi-nbi/docker-compose.yml" ]; then |
| 21 | echo 'There is nothing to clean. Exiting...' >&2 |
| 22 | exit 0 |
| 23 | fi |
| 24 | |
| 25 | cd $WORKSPACE/externalapi-nbi |
| 26 | |
| 27 | # Remove containers and attached/anonymous volume(s) |
| 28 | docker-compose down -v |
| 29 | # Force stop & remove all containers and volumes |
| 30 | docker-compose rm -f -s -v |
| 31 | |
| 32 | # clean up |
| 33 | rm -rf $WORKSPACE/externalapi-nbi |