-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
56 lines (40 loc) · 1.16 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
GOPATH:=$(shell go env GOPATH)
# ----- Installing -----
.PHONY: install
install:
go mod download
.PHONY: lint
lint:
@ [ -e ./bin/golangci-lint ] || wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest
./bin/golangci-lint run
# ----- Testing -----
BUILDENV := CGO_ENABLED=0
TESTFLAGS := -short -cover
SERVICE=fpn-auth
.PHONY: test
test:
$(BUILDENV) go test $(TESTFLAGS) ./...
.PHONY: build
build:
CGO_ENABLED=0 go build -o $(SERVICE)
.PHONY: dev
dev:
go run .
DOCKER_REGISTRY=freemiumvpn
DOCKER_CONTAINER_NAME=$(SERVICE)
DOCKER_REPOSITORY=$(DOCKER_REGISTRY)/$(DOCKER_CONTAINER_NAME)
SHA8=$(shell echo $(GITHUB_SHA) | cut -c1-8)
docker-image:
docker build --rm \
--build-arg SERVICE=$(SERVICE) \
--tag $(DOCKER_REPOSITORY):local .
ci-docker-auth:
@echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
ci-docker-build:
@docker build --rm \
--build-arg SERVICE=$(SERVICE) \
--tag $(DOCKER_REPOSITORY):$(SHA8) \
--tag $(DOCKER_REPOSITORY):latest .
ci-docker-build-push: ci-docker-build
@docker push $(DOCKER_REPOSITORY):$(SHA8)
@docker push $(DOCKER_REPOSITORY):latest