Skip to content

Commit edb5676

Browse files
committed
Improve build speed.
As CGO is only disabled on Docker, we can remve the -a flag which should increase the build speed.
1 parent 20cef75 commit edb5676

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM golang:1.9-alpine3.6 AS development
22

33
ENV PROJECT_PATH=/go/src/github.com/brocaar/lora-gateway-bridge
44
ENV PATH=$PATH:$PROJECT_PATH/build
5+
ENV CGO_ENABLED=0
6+
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"
57

68
RUN apk add --no-cache ca-certificates make git bash
79

Dockerfile-devel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM golang:1.9-alpine3.6
22

33
ENV PROJECT_PATH=/go/src/github.com/brocaar/lora-gateway-bridge
44
ENV PATH=$PATH:$PROJECT_PATH/build
5+
ENV CGO_ENABLED=0
6+
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"
57

68
RUN apk add --no-cache ca-certificates make git bash
79

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GOARCH ?= amd64
77
build:
88
@echo "Compiling source for $(GOOS) $(GOARCH)"
99
@mkdir -p build
10-
@GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X main.version=$(VERSION)" -o build/lora-gateway-bridge$(BINEXT) cmd/lora-gateway-bridge/main.go
10+
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-X main.version=$(VERSION)" -o build/lora-gateway-bridge$(BINEXT) cmd/lora-gateway-bridge/main.go
1111

1212
clean:
1313
@echo "Cleaning up workspace"
@@ -43,7 +43,7 @@ requirements:
4343
@go get -u github.com/golang/lint/golint
4444
@go get -u github.com/kisielk/errcheck
4545
@go get -u github.com/golang/dep/cmd/dep
46-
@dep ensure
46+
@dep ensure -v
4747

4848
# shortcuts for development
4949

0 commit comments

Comments
 (0)