forked from ian-kent/cachebot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
42 lines (32 loc) · 1.03 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
APP_NAME?=cachebot-test
APP_BINARY=cachebot_linux_amd64
ZIP_FILE=cachebot.zip
EB_CONFIG=.elasticbeanstalk/config.yml
.PHONY: all
all:
GOOS="linux" GOARCH="amd64" go build -o $(APP_BINARY) main.go
zip $(ZIP_FILE) $(APP_BINARY) Dockerfile
.PHONY: audit
audit:
go list -m all | nancy sleuth
VARS ?= CF_TOKEN=$(CF_TOKEN) CF_ZONE=$(CF_ZONE) SLACK_TOKEN=$(SLACK_TOKEN) GOFIGURE_ENV_ARRAYS=1 URL_BASES=https://www.ons.gov.uk,https://cy.ons.gov.uk URL_SUFFIXES=pdf,data
.PHONY: debug
debug:
TRIGGER_PHRASE="zap that cache" $(VARS) go run main.go
init: create deploy setenv
.PHONY: create
create:
eb create $(APP_NAME) --single --instance_type t2.micro
.PHONY: setenv
setenv:
eb setenv $(VARS)
# for 'eb deploy' we need to specify the artifact in the config, this will add it
.PHONY: eb-config
eb-config:
[[ "$(shell yq '.deploy.artifact' $(EB_CONFIG))" == "$(ZIP_FILE)" ]] || yq -i '.deploy.artifact = "$(ZIP_FILE)"' $(EB_CONFIG)
.PHONY: deploy
deploy: eb-config
eb deploy $(APP_NAME) --staged
.PHONY: clean
clean:
rm $(ZIP_FILE) $(APP_BINARY)