-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (42 loc) · 2.86 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
PROMPT_COLOR=\033[36m
PROMPT_NC=\033[0m # No Color
MS_IMAGE_REGISTRY = public.ecr.aws/e3b4k2v5/otterside
MS_CART_SERVICE_NAME = cart
MS_USERS_SERVICE_NAME = users
MS_FRONTEND_SERVICE_NAME = frontend
MS_PRODUCTS_SERVICE_NAME = products
MS_CHECKOUT_SERVICE_NAME = checkout
MS_NEWSLETTER_SERVICE_NAME = newsletter
HELM_CHART_PATH = ./helm
KUBECONFIG_PATH = $(HOME)/.kube/config
OTTERSIDE_NAMESPACE = otterside
# Include .env file if it exists
ifneq (,$(wildcard ./.env))
include .env
export
endif
help: ## Show help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " ${PROMPT_COLOR}%-25s${PROMPT_NC} %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
# Image building targets
build-users: ## Builds and pushes the users service image
@echo "${PROMPT_COLOR}Building users image'...${PROMPT_NC}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(MS_IMAGE_REGISTRY):$(MS_USERS_SERVICE_NAME) --push --file build/$(MS_USERS_SERVICE_NAME).Dockerfile .
build-cart: ## Builds and pushes the cart service image
@echo "${PROMPT_COLOR}Building cart image'...${PROMPT_NC}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(MS_IMAGE_REGISTRY):$(MS_CART_SERVICE_NAME) --push --file build/$(MS_CART_SERVICE_NAME).Dockerfile .
build-checkout: ## Builds and pushes the checkout service image
@echo "${PROMPT_COLOR}Building checkout image'...${PROMPT_NC}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(MS_IMAGE_REGISTRY):$(MS_CHECKOUT_SERVICE_NAME) --push --file build/$(MS_CHECKOUT_SERVICE_NAME).Dockerfile .
build-frontend: ## Builds and pushes the frontend service image
@echo "${PROMPT_COLOR}Building frontend image'...${PROMPT_NC}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(MS_IMAGE_REGISTRY):$(MS_FRONTEND_SERVICE_NAME) --push --file build/$(MS_FRONTEND_SERVICE_NAME).Dockerfile .
build-newsletter: ## Builds and pushes the newsletter service image
@echo "${PROMPT_COLOR}Building newsletter image'...${PROMPT_NC}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(MS_IMAGE_REGISTRY):$(MS_NEWSLETTER_SERVICE_NAME) --push --file build/$(MS_NEWSLETTER_SERVICE_NAME).Dockerfile .
build-products: ## Builds and pushes the products service image
@echo "${PROMPT_COLOR}Building products image'...${PROMPT_NC}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(MS_IMAGE_REGISTRY):$(MS_PRODUCTS_SERVICE_NAME) --push --file build/$(MS_PRODUCTS_SERVICE_NAME).Dockerfile .
build-images: build-users build-cart build-checkout build-frontend build-newsletter build-products ## Build and push all images
install-otterside: ## Installs Otterside in the kubernetes cluster
helm --kubeconfig=$(KUBECONFIG_PATH) dep up $(HELM_CHART_PATH); \
helm --kubeconfig=$(KUBECONFIG_PATH) upgrade --install otterside $(HELM_CHART_PATH) -n $(OTTERSIDE_NAMESPACE) --create-namespace