forked from chop-dbhi/sql-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 1.26 KB
/
Copy pathMakefile
File metadata and controls
49 lines (39 loc) · 1.26 KB
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
IMAGE_NAME := dbhi/sql-agent
PROG_NAME := sql-agent
GIT_SHA := $(or $(shell git log -1 --pretty=format:"%h" .), "latest")
GIT_TAG := $(shell git describe --tags --exact-match . 2>/dev/null)
GIT_BRANCH := $(shell git symbolic-ref -q --short HEAD)
build:
go build \
-o $(GOPATH)/bin/sql-agent \
./cmd/sql-agent
dist-build:
mkdir -p dist
cp -f $(GOPATH)/bin/sql-agent ./dist/
dist:
docker build -f Dockerfile.build -t dbhi/sql-agent-builder .
docker run --rm -it \
-v ${PWD}:/go/src/github.com/chop-dbhi/sql-agent \
dbhi/sql-agent-builder
docker:
docker build -t ${IMAGE_NAME}:${GIT_SHA} .
docker tag ${IMAGE_NAME}:${GIT_SHA} ${IMAGE_NAME}:${GIT_BRANCH}
if [ -n "${GIT_TAG}" ] ; then \
docker tag ${IMAGE_NAME}:${GIT_SHA} ${IMAGE_NAME}:${GIT_TAG} ; \
fi;
if [ "${GIT_BRANCH}" == "master" ]; then \
docker tag ${IMAGE_NAME}:${GIT_SHA} ${IMAGE_NAME}:latest ; \
fi;
prepareDeps:
go get -d
deps:
go get github.com/chop-dbhi/sql-agent
go get github.com/denisenkom/go-mssqldb
go get github.com/go-sql-driver/mysql
go get github.com/lib/pq
go get github.com/mattn/go-oci8
go get github.com/mattn/go-sqlite3
go get github.com/snowflakedb/gosnowflake
prepare: deps prepareDeps
all: prepare build dist-build dist
.PHONY: prepare prepareDeps build dist-build dist