-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
39 lines (33 loc) · 1.05 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
31
32
33
34
35
36
37
38
39
REGISTRY_HOST=docker.io
USERNAME=degauss
NAME=$(shell basename "$(CURDIR)")
IMAGE=$(REGISTRY_HOST)/$(USERNAME)/$(NAME)
.PHONY: build test shell release clean
build:
docker build -t $(IMAGE) .
test:
docker run --rm -v "${PWD}/test":/tmp $(IMAGE) my_address_file.csv
docker run --rm -v "${PWD}/test":/tmp $(IMAGE) my_address_file.csv 0.6
docker run --rm -v "${PWD}/test":/tmp $(IMAGE) my_address_file.csv all
shell:
docker run --rm -it --entrypoint=/bin/bash -v "${PWD}/test":/tmp $(IMAGE)
release:
ifndef VERSION
$(error VERSION is not set. Usage: "make release VERSION=X.X")
endif
ifndef DOCKER_USERNAME
$(error DOCKER_USERNAME is not set)
endif
ifndef DOCKER_PAT
$(error DOCKER_PAT is not set)
endif
git commit -am "Release for image version $(VERSION)" --allow-empty
git tag -a $(VERSION) -m "${VERSION}"
git push origin ${VERSION}
git push
echo "${DOCKER_PAT}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
docker tag ${IMAGE}:latest ${IMAGE}:${VERSION}
docker push ${IMAGE}:${VERSION}
docker push ${IMAGE}:latest
clean:
docker system prune -f