generated from ibm-developer-skills-network/aolwx-devops-capstone-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (58 loc) · 2.79 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.PHONY: all help install venv run
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-\\.]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
all: help
.PHONY: cluster
cluster: ## Create a Kubernetes cluster
$(info Creating Kubernetes cluster with a registry...)
k3d cluster create --registry-create cluster-registry:0.0.0.0:32000 --port '8080:80@loadbalancer'
.PHONY: tekton
tekton: ## Install Tekton into cluster
$(info Installing Tekton in the Cluster...)
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml
kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/tekton-dashboard-release.yaml
.PHONY: clustertasks
clustertasks: ## Create Tekton Cluster Tasks
$(info Creating Tekton Cluster Tasks...)
wget -qO - https://raw.githubusercontent.com/tektoncd/catalog/main/task/openshift-client/0.2/openshift-client.yaml | sed 's/kind: Task/kind: ClusterTask/g' | kubectl create -f -
wget -qO - https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.4/buildah.yaml | sed 's/kind: Task/kind: ClusterTask/g' | kubectl create -f -
.PHONY: build
build: ## Build a Docker image
$(info Building Docker image...)
docker build --rm --pull --tag accounts:1.0 .
.PHONY: push
push: ## Push image to K3d registry
$(info Pushing Docker image to K3D registry...)
docker tag accounts:1.0 localhost:32000/accounts:1.0
docker push localhost:32000/accounts:1.0
venv: ## Create a Python virtual environment
$(info Creating Python 3 virtual environment...)
python3 -m venv ~/venv
install: ## Install Python dependencies
$(info Installing dependencies...)
python3 -m pip install --upgrade pip wheel
pip install -r requirements.txt
lint: ## Run the linter
$(info Running linting...)
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
.PHONY: tests
tests: ## Run the unit tests
$(info Running tests...)
nosetests -vv --with-spec --spec-color --with-coverage --cover-package=service
run: ## Run the service
$(info Starting service...)
honcho start
dbrm: ## Stop and remove PostgreSQL in Docker
$(info Stopping and removing PostgreSQL...)
docker stop postgres
docker rm postgres
db: ## Run PostgreSQL in Docker
$(info Running PostgreSQL...)
docker run -d --name postgresql \
-p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-v postgresql:/var/lib/postgresql/data \
postgres:alpine