forked from fpco/haskell.fpcomplete.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (37 loc) · 1.38 KB
/
Makefile
File metadata and controls
46 lines (37 loc) · 1.38 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
.PHONY: help build build-docker-image deploy run push
DEFAULT_GOAL: help
PROJECT_NAME ?= hfp
require-%:
@ if [ "${${*}}" = "" ]; then \
echo "ERROR: Environment variable not set: \"$*\""; \
exit 1; \
fi
## Build project
build:
@mkdir -p build
@stack build --copy-bins --local-bin-path=build
## Run docker image
run: require-CI_REGISTRY_IMAGE require-CI_PIPELINE_ID
@docker run -it -p 3000:3000 "${CI_REGISTRY_IMAGE}:pipeline-${CI_PIPELINE_ID}"
## Push docker image
push: require-CI_REGISTRY_IMAGE require-CI_PIPELINE_ID
@docker push "${CI_REGISTRY_IMAGE}:pipeline-${CI_PIPELINE_ID}"
## Build docker image. Used in CI/CD
build-docker-image: require-CI_REGISTRY_IMAGE require-CI_PIPELINE_ID
@docker build -t "${CI_REGISTRY_IMAGE}:pipeline-${CI_PIPELINE_ID}" .
## Deploy using helm
deploy: require-CI_ENVIRONMENT_NAME require-CI_PIPELINE_ID
@echo "Deploying build pipeline: ${CI_PIPELINE_ID}"
@kubectl set image deployment/hfp-prod hfp="${CI_REGISTRY_IMAGE}:pipeline-${CI_PIPELINE_ID}"
## Show help screen.
help:
@echo "Please use \`make <target>' where <target> is one of\n\n"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "%-30s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)