-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (30 loc) · 893 Bytes
/
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
BINARY_UNIX=$(REPONAME)_unix
PACKAGES ?= "./..."
DOCKERNAME = "pococknick91"
REPONAME ?= "recs-api"
IMG ?= ${DOCKERNAME}/${REPONAME}:${VERSION}
LATEST ?= ${DOCKERNAME}/${REPONAME}:latest
VERSION = $(shell cat ./VERSION)
DEFAULT: test
build:
@GO111MODULE=on go build "${PACKAGES}"
build-image:
@docker build -t ${IMG} .
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BINARY_UNIX) -v
install:
@echo "=> Install dependencies"
@GO111MODULE=on go mod download
push-to-registry:
@docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
@docker build -t ${IMG} .
@docker tag ${IMG} ${LATEST}
echo "=> Pushing ${IMG} & ${LATEST} to docker"
@docker push ${DOCKERNAME}/${REPONAME}
run:
@go build -ldflags "-X main.Version=dev"
@ENV=development AWS_REGION=eu-west-1 ./recs-api
test:
@GO111MODULE=on go test "${PACKAGES}" -cover
vet:
@@GO111MODULE=on go vet "${PACKAGES}"