forked from airdock-io/docker-fake-sns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (21 loc) · 1.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
NAME = airdock/fake-sns
VERSION = 1.0
.PHONY: all clean build tag_latest release debug run
all: build
clean:
@CID=$(shell docker ps -a | awk '{ print $$1 " " $$2 }' | grep $(NAME) | awk '{ print $$1 }'); if [ ! -z "$$CID" ]; then echo "Removing container which reference $(NAME)"; for container in $(CID); do docker rm -f $$container; done; fi;
@if docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then docker rmi -f $(NAME):$(VERSION); fi
@if docker images $(NAME) | awk '{ print $$2 }' | grep -q -F latest; then docker rmi -f $(NAME):latest; fi
build: clean
docker build -t $(NAME):$(VERSION) --rm .
tag_latest:
@docker tag $(NAME):$(VERSION) $(NAME):latest
release: build tag_latest
docker push $(NAME)
@echo "Create a tag v-$(VERSION)"
@git tag v-$(VERSION)
@git push origin v-$(VERSION)
debug:
docker run -t -i $(NAME):$(VERSION) /bin/bash -l
run:
@echo "IPAddress =" $$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $$(docker run -d -p 9292:9292--name fake-sns $(NAME):$(VERSION)))