-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
127 lines (93 loc) · 4.31 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
REPOSITORY_REF ?= redhat.io/demo-soa
FRONTEND_IMAGE_REF ?= $(REPOSITORY_REF)/frontend:latest
CATALOG_IMAGE_REF ?= $(REPOSITORY_REF)/catalog:latest
CATALOG_INIT_IMAGE_REF ?= $(REPOSITORY_REF)/catalog-init:latest
ORDERS_IMAGE_REF ?= $(REPOSITORY_REF)/orders:latest
ORDERS_INIT_IMAGE_REF ?= $(REPOSITORY_REF)/orders-init:latest
ORDERS_EVENTS_CONSUMER_IMAGE_REF ?= $(REPOSITORY_REF)/orders-events-consumer:latest
DOCKER_BUILD_ARGS ?=
MANIFESTS_FOLDER ?= config/manifests
# Local development
.PHONY: run-dev-locally
run-dev-locally: clean-local-dev
docker compose -f docker-compose.yaml -f docker-compose.dev.yaml up --build
.PHONY: clean-local-dev
clean-local-dev:
docker compose -f docker-compose.yaml -f docker-compose.dev.yaml down
.PHONY: run-locally
run-locally:
docker compose up --build
.PHONY: run-backend-locally
run-backend-locally:
docker compose up --build catalog catalog-init orders orders-init sns orders-db orders-events-consumer
# Kubernetes
.PHONY: manifests
manifests:
kustomize build $(MANIFESTS_FOLDER)
.PHONY: install
install:
kubectl apply -k $(MANIFESTS_FOLDER)
.PHONY: uninstall
uninstall:
kubectl delete -k $(MANIFESTS_FOLDER)
.PHONY: deploy-cert-manager
deploy-cert-manager:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml
kubectl rollout status -n cert-manager deploy/cert-manager-webhook -w --timeout=120s
# Docker
.PHONY: docker-build-frontend
docker-build-frontend:
docker build $(DOCKER_BUILD_ARGS) -t $(FRONTEND_IMAGE_REF) frontend/eshop
.PHONY: docker-build-catalog
docker-build-catalog:
docker build $(DOCKER_BUILD_ARGS) -t $(CATALOG_IMAGE_REF) -f services/catalog/deploy/catalog/Dockerfile services/catalog
.PHONY: docker-build-catalog-init
docker-build-catalog-init:
docker build $(DOCKER_BUILD_ARGS) -t $(CATALOG_INIT_IMAGE_REF) -f services/catalog/deploy/init/Dockerfile services/catalog
.PHONY: docker-build-orders
docker-build-orders:
docker build $(DOCKER_BUILD_ARGS) -t $(ORDERS_IMAGE_REF) -f services/orders/deploy/orders/Dockerfile services/orders
.PHONY: docker-build-orders-events-consumer
docker-build-orders-events-consumer:
docker build $(DOCKER_BUILD_ARGS) -t $(ORDERS_EVENTS_CONSUMER_IMAGE_REF) -f services/orders-events-consumer/Dockerfile services/orders-events-consumer
.PHONY: docker-build-orders-init
docker-build-orders-init:
docker build $(DOCKER_BUILD_ARGS) -t $(ORDERS_INIT_IMAGE_REF) -f services/orders/deploy/init/Dockerfile services/orders
.PHONY: docker-build-all
docker-build-all: docker-build-frontend docker-build-catalog docker-build-catalog-init docker-build-orders docker-build-orders-init docker-build-orders-events-consumer
.PHONY: docker-push-frontend
docker-push-frontend: docker-build-frontend
docker push $(FRONTEND_IMAGE_REF)
.PHONY: docker-push-catalog
docker-push-catalog: docker-build-catalog
docker push $(CATALOG_IMAGE_REF)
.PHONY: docker-push-catalog-init
docker-push-catalog-init: docker-build-catalog-init
docker push $(CATALOG_INIT_IMAGE_REF)
.PHONY: docker-push-orders
docker-push-orders: docker-build-orders
docker push $(ORDERS_IMAGE_REF)
.PHONY: docker-push-orders-events-consumer
docker-push-orders-events-consumer: docker-build-orders-events-consumer
docker push $(ORDERS_EVENTS_CONSUMER_IMAGE_REF)
.PHONY: docker-push-orders-init
docker-push-orders-init: docker-build-orders-init
docker push $(ORDERS_INIT_IMAGE_REF)
.PHONY: docker-push-all
docker-push-all: docker-build-all docker-push-frontend docker-push-orders docker-push-orders-init docker-push-orders-events-consumer docker-push-catalog docker-push-catalog-init
# Code Generation
FRONTEND_CLIENTS_FOLDER=frontend/eshop/src/Clients/
.PHONY: generate-orders-client
generate-orders-client:
LANG=typescript-axios; docker run --rm -v ${PWD}:/local:Z --user $(id -u):$(id -g) openapitools/openapi-generator-cli \
generate -i /local/services/orders/apis/openapi.yaml -g $$LANG -o /local/$(FRONTEND_CLIENTS_FOLDER)/orders/
.PHONY: generate-catalog-client
generate-catalog-client:
LANG=typescript-axios; docker run --rm -v ${PWD}:/local:Z --user $(id -u):$(id -g) openapitools/openapi-generator-cli \
generate -i /local/services/catalog/apis/openapi.yaml -g $$LANG -o /local/$(FRONTEND_CLIENTS_FOLDER)/catalog/
.PHONY: generate-clients
generate-clients: generate-catalog-client generate-orders-client
# print variables
.PHONY: print-%
print-%:
@echo $($*)