Moshe | 0bb532c | 2018-02-26 13:39:57 +0200 | [diff] [blame^] | 1 | ############################################################################## |
| 2 | # Copyright 2018 EuropeanSoftwareMarketingLtd. |
| 3 | # =================================================================== |
| 4 | # Licensed under the ApacheLicense, Version2.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 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # software distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | # See the License for the specific language governing permissions and limitations under |
| 12 | # the License |
| 13 | ############################################################################## |
| 14 | # vnftest comment: this is a modified copy of |
| 15 | # yardstick/docker/Makefile |
| 16 | |
| 17 | SHELL = /bin/bash |
| 18 | |
| 19 | IMAGE = onap/vnftest |
| 20 | |
| 21 | DOCKER_TAG = beijing.0 |
| 22 | |
| 23 | .PHONY: all |
| 24 | all: .docker |
| 25 | |
| 26 | .docker: |
| 27 | /usr/bin/docker build --rm=true --no-cache=true -t $(IMAGE):$(DOCKER_TAG) . |
| 28 | /usr/bin/docker tag $(IMAGE):$(DOCKER_TAG) $(IMAGE):latest |
| 29 | touch .docker |
| 30 | |
| 31 | |
| 32 | .PHONY: clean |
| 33 | clean: |
| 34 | @docker ps | grep $(IMAGE) | awk '{print $$1}' | xargs -r docker stop |
| 35 | @docker ps -a | grep $(IMAGE) | awk '{print $$1}' | xargs -r docker rm |
| 36 | @echo "Docker images to remove:" |
| 37 | @docker images | head -1 && docker images | grep $(IMAGE) || true |
| 38 | @image_tags=($$(docker images | grep $(IMAGE) | awk '{print $$2}')) ; \ |
| 39 | for tag in "$${image_tags[@]}"; do \ |
| 40 | echo "Removing docker image $(IMAGE):$$tag..." ; \ |
| 41 | docker rmi $(IMAGE):$$tag ; \ |
| 42 | done |
| 43 | rm -f .docker |