-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (69 loc) · 1.96 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
IMAGE_NAME = spacetabio/prerender-go
IMAGE_VERSION = v1.2.0
deps:
go mod vendor
build:
go build -o ./bin/prerender .
.PHONY: build
build_vendor:
go build -mod=vendor -o ./bin/prerender .
.PHONY: build_vendor
build_for_docker:
GOOS=linux GOARCH=amd64 go build -o ./bin/prerender .
.PHONY: build_for_docker
build_vendor_for_docker:
GOOS=linux GOARCH=amd64 go build -mod=vendor -o ./bin/prerender .
.PHONY: build_for_docker
run:
./bin/prerender
.PHONY: run
run_in_docker:
docker run \
--rm \
--name headless-shell \
-v $$(pwd)/configuration/:/app/configuration/ \
-v $$(pwd)/bin/prerender:/app/bin/prerender \
-v $$(pwd)/pages:/app/pages \
-w /app \
alpeware/chrome-headless-trunk \
./bin/prerender
all: build_vendor
.PHONY: all
all_ubuntu: build_vendor_for_docker
.PHONY: all_ubuntu
go: build run
.PHONY: go
go_docker: deps build_for_docker run_in_docker
.PHONY: go_docker
run_headless_shell:
docker run -it --rm -p 9222:9222 \
--name=chrome-headless \
-v /tmp/chromedata/:/data alpeware/chrome-headless-trunk bash
## -------------------
# ----
## LINTER stuff start
linter_include_check:
@[ -f linter.mk ] && echo "linter.mk include exists" || (echo "getting linter.mk from github.com" && curl -sO https://raw.githubusercontent.com/spacetab-io/makefiles/master/golang/linter.mk)
.PHONY: lint
lint: linter_include_check
@make -f linter.mk go_lint
## LINTER stuff end
# ----
# ----
## TESTS stuff start
tests_include_check:
@[ -f tests.mk ] && echo "tests.mk include exists" || (echo "getting tests.mk from github.com" && curl -sO https://raw.githubusercontent.com/spacetab-io/makefiles/master/golang/tests.mk)
tests: tests_include_check
@make -f tests.mk go_tests
.PHONY: tests
tests_html: tests_include_check
@make -f tests.mk go_tests_html
.PHONY: tests_html
## TESTS stuff end
# ----
## image stuff
image_build:
docker build -t ${IMAGE_NAME}:${IMAGE_VERSION} .
image_push:
docker push ${IMAGE_NAME}:${IMAGE_VERSION}
image: image_build image_push