-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (46 loc) · 1.38 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
include scripts/help.mk
.PHONY: clean install test build image run run-docker stop-docker
.DEFAULT_GOAL := help
project = beatport
build = $(shell git rev-parse --short HEAD)
image = jeanmorais/$(project):$(build)
.PHONY: clean
clean: ##@dev Remove vendor folder and coverage report.
rm -rf vendor filtered_coverage.out
.PHONY: install
install: clean ##@dev Download dependencies via go mod.
GO111MODULE=on go mod download
GO111MODULE=on go mod vendor
.PHONY: test
test:##@test Run tests and coverage.
DOCKER_BUILDKIT=1 \
docker build --progress=plain \
--tag $(image) \
--target=test \
--file=Dockerfile .
docker create --name $(project)-$(build) $(image)
docker cp $(project)-$(build):/filtered_coverage.out filtered_coverage.out
docker rm -vf $(project)-$(build)
.PHONY: build
build:##@build Run the build process using Docker.
DOCKER_BUILDKIT=1 \
docker build --progress=plain \
--tag $(image) \
--target=build \
--file=Dockerfile .
.PHONY: image
image:##@build Generate beatport api docker image.
DOCKER_BUILDKIT=1 \
docker build --progress=plain \
--tag $(image) \
--target=image \
--file=Dockerfile .
.PHONY: run
run:##@dev Run locally.
go run cmd/beatport/main.go
.PHONY: run-docker
run-docker:##@dev Run docker container.
docker run --name $(project) -p 8080:8080 $(image)
.PHONY: stop-docker
stop-docker:##@dev Remove docker container.
docker rm -f $(project)