-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (45 loc) · 1.6 KB
/
Makefile
File metadata and controls
55 lines (45 loc) · 1.6 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Convenience Makefile
# Useful reference: https://makefiletutorial.com
GIT_SHA := $(shell git rev-parse --short HEAD)
VERSION ?= 0.0.0-dev0.${GIT_SHA}
PYTHON_VERSION := $(shell echo "${VERSION}" | sed -e 's/-dev0\./-dev0+/')
WHEEL_VERSION := $(shell echo "${VERSION}" | sed -e 's/-dev0\./.dev0+/')
ROOT_PATH := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
PYTHON_SOURCES := $(shell find src/mrmat_python_api_flask -name '*.py')
PYTHON_TARGET := dist/mrmat_python_api_flask-${WHEEL_VERSION}-py3-none-any.whl
CONTAINER_SOURCES := $(shell find var/container)
HELM_SOURCES := $(shell find var/helm)
HELM_TARGET := dist/mrmat-python-api-flask-$(VERSION).tgz
all: python container helm
python: $(PYTHON_TARGET)
helm: $(HELM_TARGET)
$(PYTHON_TARGET): $(PYTHON_SOURCES)
MRMAT_VERSION="${PYTHON_VERSION}" python -mbuild -n --wheel
$(HELM_TARGET): $(HELM_SOURCES) container
helm package \
--app-version "$(VERSION)" \
--version $(VERSION) \
--destination dist/ \
var/helm
container: $(PYTHON_TARGET) $(CONTAINER_SOURCES)
docker build \
-f var/container/Dockerfile \
-t localhost:5001/mrmat-python-api-flask:$(VERSION) \
--build-arg MRMAT_VERSION=$(VERSION) \
--build-arg WHEEL=$(PYTHON_TARGET) \
$(ROOT_PATH)
docker push localhost:5001/mrmat-python-api-flask:$(VERSION)
helm-install: $(HELM_TARGET)
kubectl create ns mpaflask || true
kubectl label --overwrite ns mpaflask istio-injection=true
helm upgrade \
mrmat-python-api-flask \
${HELM_TARGET} \
--install \
--force \
--namespace mpaflask
helm-uninstall:
helm delete -n mpaflask mrmat-python-api-flask
clean:
rm -rf build dist