Skip to content

Commit

Permalink
updating build process
Browse files Browse the repository at this point in the history
  • Loading branch information
xphyr committed Aug 2, 2019
1 parent c6133f1 commit 4a42f88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ builds:
main: ./cmd/ecs_exporter.go
env:
- CGO_ENABLED=0
- GOPROXY=https://proxy.golang.org
- GO111MODULE=on
goos:
- linux
- windows
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ TARGET_BINARY := prometheus-emcecs-exporter
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
RELEASE?=$(shell git describe --abbrev=4 --dirty --always --tags)
COMMIT?=$(shell git rev-parse --short HEAD)
GOPROXY?=https://proxy.golang.org

all: clean build
goreleaser_hook: clean goreleaser_pre

build:
GO111MODULE=on go build -o bin/${TARGET_BINARY} \
GOPROXY=${GOPROXY} GO111MODULE=on go build -o bin/${TARGET_BINARY} \
-ldflags="-X main.commit=${COMMIT} \
-X main.date=${BUILD_TIME} \
-X main.version=${RELEASE}" \
Expand All @@ -21,10 +22,10 @@ goreleaser:
# Since cross compiling requires special modules for Windows
# we need to run the commands for both Windows and Linux
goreleaser_pre:
GOOS=linux GOARCH=amd64 go mod download
GOOS=windows GOARCH=amd64 go mod download
GOOS=linux GOARCH=amd64 go get ./...
GOOS=windows GOARCH=amd64 go get ./...
GOPROXY=${GOPROXY} GOOS=linux GOARCH=amd64 go mod download
GOPROXY=${GOPROXY} GOOS=windows GOARCH=amd64 go mod download
GOPROXY=${GOPROXY} GOOS=linux GOARCH=amd64 go get ./...
GOPROXY=${GOPROXY} GOOS=windows GOARCH=amd64 go get ./...

clean:
for file in bin/$(TARGET_BINARY); do \
Expand Down

0 comments on commit 4a42f88

Please sign in to comment.