Last active
December 18, 2017 12:47
-
-
Save orasik/059d978787a1bece8b47c9383b4036ef to your computer and use it in GitHub Desktop.
Building Go app using docker locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this code inside your app code | |
# /go/src/app <- is the location of your app inside the container | |
# if you use /go or /go/src it will not compile and you'll get error: no install location for directory outside GOPATH | |
# you can change `app` to any name though | |
# This will build binary for linux, you can change to Windows or Mac by changing GOARCH | |
# Check a full list of GOARCH and GOOS here: https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63 | |
docker run --rm -v "$PWD":/go/src/app -w /go/src/app golang:1.9 go get -v && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment