-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.vars
43 lines (35 loc) · 1.57 KB
/
Makefile.vars
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
PROJECT_ROOT := github.com/tcvem/backend
BUILD_PATH := bin
DOCKERFILE_PATH := $(CURDIR)/docker
# configuration for image names
USERNAME := $(USER)
GIT_COMMIT := $(shell git describe --dirty=-unsupported --always --tags || echo pre-commit)
IMAGE_VERSION ?= $(GIT_COMMIT)-$(USERNAME)
IMAGE_REGISTRY ?= tcvem
# configuration for server binary and image
SERVER_BINARY := $(BUILD_PATH)/server
SERVER_PATH := $(PROJECT_ROOT)/cmd/server
SERVER_IMAGE := $(IMAGE_REGISTRY)/backend-server
SERVER_DOCKERFILE := $(DOCKERFILE_PATH)/Dockerfile
# configuration for the protobuf gentool
SRCROOT_ON_HOST := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
SRCROOT_IN_CONTAINER := /go/src/$(PROJECT_ROOT)
DOCKER_RUNNER := docker run -u `id -u`:`id -g` --rm
DOCKER_RUNNER += -v $(SRCROOT_ON_HOST):$(SRCROOT_IN_CONTAINER)
DOCKER_GENERATOR := infoblox/atlas-gentool:latest
GENERATOR := $(DOCKER_RUNNER) $(DOCKER_GENERATOR)
# configuration for the database
WITH_DATABASE = true
DATABASE_ADDRESS ?= localhost:5432
DATABASE_USERNAME ?= postgres
DATABASE_PASSWORD ?= postgres
DATABASE_NAME = backend
DATABASE_URL ?= postgres://$(DATABASE_USERNAME):$(DATABASE_PASSWORD)@$(DATABASE_ADDRESS)/$(DATABASE_NAME)?sslmode=disable
MIGRATETOOL_IMAGE = infoblox/migrate:latest
MIGRATION_PATH_IN_CONTAINER = $(SRCROOT_IN_CONTAINER)/db/migrations
# configuration for building on host machine
GO_CACHE := -pkgdir $(BUILD_PATH)/go-cache
GO_BUILD_FLAGS ?= $(GO_CACHE) -i -v
GO_TEST_FLAGS ?= -v -cover
GO_PACKAGES := $(shell go list ./... | grep -v vendor)
#configuration for gateway