generated from edenia/website-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
104 lines (90 loc) · 4.28 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
include utils/meta.mk
LATEST_TAG ?= latest
install: ##@local Install all dependencies
install:
@yarn
clean-install: ##@local Reinstalls all dependencies
clean-install:
@rm -Rf node_modules
@yarn
run: ##@local Run the project locally (without docker)
run:
@echo "WEBAPP RUN"
@$(SHELL_EXPORT) yarn && yarn dev | cat
@echo "done webapp"
build-docker: ##@devops Build the docker image
build-docker: ./Dockerfile
@echo "DOCKER WEBAPP"
echo "Building containers..."
@docker pull $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(LATEST_TAG) || true
@docker build \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(VERSION) --target runner \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(LATEST_TAG) --target runner \
--build-arg next_public_ual_app_name="$(NEXT_PUBLIC_UAL_APP_NAME)" \
--build-arg next_public_ual_api_protocol="$(NEXT_PUBLIC_UAL_API_PROTOCOL)" \
--build-arg next_public_ual_api_host="$(NEXT_PUBLIC_UAL_API_HOST)" \
--build-arg next_public_ual_api_port="$(NEXT_PUBLIC_UAL_API_PORT)" \
--build-arg next_public_ual_chain_id="$(NEXT_PUBLIC_UAL_CHAIN_ID)" \
--build-arg next_public_aa_api_host="$(NEXT_PUBLIC_AA_API_HOST)" \
--build-arg next_public_genesiseden_contract="$(NEXT_PUBLIC_GENESISEDEN_CONTRACT)" \
--build-arg next_public_edensmartproxy_contract="$(NEXT_PUBLIC_EDENSMARTPROXY_CONTRACT)" \
--build-arg next_public_myvoteeosdao_contract="$(NEXT_PUBLIC_MYVOTEEOSDAO_CONTRACT)" \
--build-arg next_public_eden_api_host="$(NEXT_PUBLIC_EDEN_API_HOST)" \
--build-arg next_public_eden_member_url="$(NEXT_PUBLIC_EDEN_MEMBER_URL)" \
--build-arg next_public_eden_block_explorer_url="$(NEXT_PUBLIC_EDEN_BLOCK_EXPLORER_URL)" \
--build-arg next_public_producers_info_api_url="$(NEXT_PUBLIC_PRODUCERS_INFO_API_URL)" \
--build-arg eosrate_get_stats_url="$(EOSRATE_GET_STATS_URL)" \
--build-arg eosrate_get_stats_user="$(EOSRATE_GET_STATS_USER)" \
--build-arg eosrate_get_stats_password="$(EOSRATE_GET_STATS_PASSWORD)" \
.
pull-image: ##@devops Pull the latest image from registry for caching
pull-image:
@docker pull $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(LATEST_TAG) || true
build-docker-cached: ##@devops Build the docker image using cached layers
build-docker-cached: ./Dockerfile
@docker build \
--target runner \
--cache-from $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(LATEST_TAG) \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(VERSION) \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(LATEST_TAG) \
.
push-image: ##@devops Push the freshly built image and tag with release or latest tag
push-image:
@docker push $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(VERSION)
@docker push $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(LATEST_TAG)
build-kubernetes: ##@devops Generate proper k8s files based on the templates
build-kubernetes: ./k8s-$(ENVIRONMENT)
@echo "Build kubernetes files..."
@rm -Rf $(K8S_BUILD_DIR) && mkdir -p $(K8S_BUILD_DIR)
@for file in $(K8S_FILES); do \
mkdir -p `dirname "$(K8S_BUILD_DIR)/$$file"`; \
$(SHELL_EXPORT) envsubst <./k8s-$(ENVIRONMENT)/$$file >$(K8S_BUILD_DIR)/$$file; \
done
deploy-kubernetes: ##@devops Publish the build k8s files
deploy-kubernetes: $(K8S_BUILD_DIR)
@kubectl create ns $(NAMESPACE) || echo "Namespace '$(NAMESPACE)' already exists.";
@for file in $(shell find $(K8S_BUILD_DIR) -name '*.yml' | sed 's:$(K8S_BUILD_DIR)/::g'); do \
kubectl apply -n edenproxy -f $(K8S_BUILD_DIR)/$$file; \
done
build-docker-voter: ##@devops Build the docker image
build-docker-voter: ./Dockerfile
@docker pull $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(VERSION) || true
@docker build \
--target release \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(VERSION) \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(LATEST_TAG) \
./voter
pull-image-voter: ##@devops Pull the latest image from registry for caching
pull-image-voter:
@docker pull $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(LATEST_TAG) || true
build-docker-cached-voter: ##@devops Build the docker image using cached layers
build-docker-cached-voter: ./Dockerfile
@docker build \
--target prod-stage \
--cache-from $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(LATEST_TAG) \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(VERSION) \
-t $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(LATEST_TAG) \
./voter
push-image-voter: ##@devops Push the freshly built image and tag with release or latest tag
push-image-voter:
@docker push $(DOCKER_REGISTRY)/$(IMAGE_NAME_VOTER):$(VERSION)