Skip to content

Instantly share code, notes, and snippets.

@awalterschulze
Created October 20, 2017 08:39
Show Gist options
  • Save awalterschulze/022bba6161a4a724524f34150b4cd1f9 to your computer and use it in GitHub Desktop.
Save awalterschulze/022bba6161a4a724524f34150b4cd1f9 to your computer and use it in GitHub Desktop.
building go with a docker
GODOCKER = docker run --network host --rm --user $(shell id -u):$(shell id -g) -v $(PWD):/go/src/path/to/project -w /go/src/path/to/project golang:1.8.3-alpine3.6
GOFLAGS = -ldflags '-d' -tags netgo -installsuffix netgo
build:
$(GODOCKER) go build $(GOFLAGS) -o ./cmd/mycmd/mycmd ./cmd/mycmd
test:
$(GODOCKER) go test -test.v ./...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment