2018-04-18 19:28:33 +00:00
|
|
|
#REGISTRY ?= ensl
|
2018-04-18 14:09:48 +00:00
|
|
|
PROJECT ?= ensl-plugin
|
|
|
|
TAG ?= latest
|
|
|
|
|
2018-04-18 19:58:38 +00:00
|
|
|
.PHONY: all test clean build
|
|
|
|
|
2018-04-18 14:09:48 +00:00
|
|
|
ifdef REGISTRY
|
|
|
|
IMAGE=$(REGISTRY)/$(PROJECT):$(TAG)
|
|
|
|
else
|
2018-04-18 19:28:33 +00:00
|
|
|
IMAGE=$(PROJECT)
|
2018-04-18 14:09:48 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
all:
|
|
|
|
@echo "Available targets:"
|
|
|
|
@echo " * build - build a Docker image for $(IMAGE)"
|
|
|
|
@echo " * pull - pull $(IMAGE)"
|
|
|
|
@echo " * push - push $(IMAGE)"
|
|
|
|
@echo " * test - build and test $(IMAGE)"
|
|
|
|
|
2018-04-18 19:58:38 +00:00
|
|
|
build:
|
2018-04-18 19:28:33 +00:00
|
|
|
docker build . -t $(IMAGE)
|
2018-04-18 14:09:48 +00:00
|
|
|
|
|
|
|
run: build
|
2018-04-18 19:58:38 +00:00
|
|
|
mkdir -p build
|
2018-04-18 14:09:48 +00:00
|
|
|
docker run -v $(shell pwd)/build/:/var/build -ti $(IMAGE)
|
|
|
|
|
|
|
|
pull:
|
|
|
|
docker pull $(IMAGE) || true
|
|
|
|
|
|
|
|
push:
|
|
|
|
docker push $(IMAGE)
|
|
|
|
|
|
|
|
clean:
|
2018-04-18 19:28:33 +00:00
|
|
|
rm -rf $(shell pwd)/build/*
|
2018-04-18 19:35:14 +00:00
|
|
|
docker ps -a | awk '{ print $$1,$$2 }' | grep $(IMAGE) |awk '{print $$1 }' |xargs -I {} docker rm {}
|
|
|
|
docker images -a |grep $(IMAGE) |awk '{print $$3}' |xargs -I {} docker rmi {}
|
2018-04-18 14:09:48 +00:00
|
|
|
|
|
|
|
test: build
|
|
|
|
@echo "TODO"
|