Skip to content

Instantly share code, notes, and snippets.

@mtigdemir
Created November 26, 2018 12:59
Show Gist options
  • Save mtigdemir/1f79e28f6b9d26914546362707b7ca56 to your computer and use it in GitHub Desktop.
Save mtigdemir/1f79e28f6b9d26914546362707b7ca56 to your computer and use it in GitHub Desktop.
Go Build on Docker
# Why did you have to build the binary with such an ugly command line?
# You have to explicitly make the binary static.
# This is really important in the Docker community right now because alpine has a different implementation of libc.
# So your go binary wouldn't have had the lib it needed if it wasn't static.
# You created a static binary so that your application could be self-contained.
go build --tags netgo --ldflags '-extldflags "-lm -lstdc++ -static"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment