-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
60 lines (49 loc) · 1.82 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
VERSION := $(shell cat version.txt)
DOCKER_REGISTRY ?= ghcr.io
DOCKER_BUILDER_VERSION ?= 1.17.8-bullseye
DOCKER_RUNTIME_VERSION ?= bullseye-20220228-slim
DOCKER_IMAGE = energostack/bisquitt
# Enable data race detection in the compiled binaries.
ifeq ($(WITH_RACE_DETECTION), 1)
EXTRA_BUILD_ARGS += -race
endif
.PHONY: build
build:
cd cmd/bisquitt && go build $(EXTRA_BUILD_ARGS)
cd cmd/bisquitt-pub && go build $(EXTRA_BUILD_ARGS)
cd cmd/bisquitt-sub && go build $(EXTRA_BUILD_ARGS)
.PHONY: update
update:
go get -u ./...
.PHONY: tidy
tidy:
go mod tidy
.PHONY: fmt
fmt:
goimports -w ./
.PHONY: test
test:
go test ./...
.PHONY: docker/test
docker/test:
docker-compose -f docker-compose.test.yaml build \
--build-arg "WITH_RACE_DETECTION=1" \
--build-arg "DOCKER_BUILDER_VERSION=$(DOCKER_BUILDER_VERSION)" \
--build-arg "DOCKER_RUNTIME_VERSION=$(DOCKER_RUNTIME_VERSION)"
docker-compose -f docker-compose.test.yaml up --remove-orphans --abort-on-container-exit --exit-code-from bisquitt-test
.PHONY: docker/build
docker/build:
docker build --build-arg "DOCKER_BUILDER_VERSION=$(DOCKER_BUILDER_VERSION)" \
--build-arg "DOCKER_RUNTIME_VERSION=$(DOCKER_RUNTIME_VERSION)" \
-f docker/Dockerfile -t "$(DOCKER_IMAGE):latest" -t "$(DOCKER_IMAGE):$(VERSION)" .
.PHONY: docker/push
docker/push:
docker tag "$(DOCKER_IMAGE):latest" "$(DOCKER_REGISTRY)/$(DOCKER_IMAGE):latest"
docker tag "$(DOCKER_IMAGE):$(VERSION)" "$(DOCKER_REGISTRY)/$(DOCKER_IMAGE):$(VERSION)"
docker push "$(DOCKER_REGISTRY)/$(DOCKER_IMAGE):latest"
docker push "$(DOCKER_REGISTRY)/$(DOCKER_IMAGE):$(VERSION)"
.PHONY: docker/run
docker/run:
docker-compose build --build-arg "DOCKER_BUILDER_VERSION=$(DOCKER_BUILDER_VERSION)" \
--build-arg "DOCKER_RUNTIME_VERSION=$(DOCKER_RUNTIME_VERSION)"
docker-compose up --remove-orphans --abort-on-container-exit