Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I build a Go executable in a Docker container that can be executed on MacOS or Windows #29

Closed
janbaer opened this issue Aug 27, 2016 · 0 comments

Comments

@janbaer
Copy link
Owner

janbaer commented Aug 27, 2016

To build an executable for another platform than the current platform (Docker is running on a Linux OS) you've to set the GOOS environment variable. So you can build executable binaries for MacOS (darwin) and Windows platforms.

GOOS=darwin GOARCH=amd64 go build
GOOS=windows GOARCH=386 go build
GOOS=linux GOARCH=amd64 go build

To find out which platform you've to define for your current system, you can install the node module go-platform. This return the current os and cpu-architecture.

@janbaer janbaer added the Go label Aug 27, 2016
@janbaer janbaer closed this as completed Aug 27, 2016
@janbaer janbaer changed the title How can I build a Go executable in a Docker container that is runnable on MacOS How can I build a Go executable in a Docker container that can be executed on MacOS or Windows Aug 27, 2016
@janbaer janbaer added the Docker label Aug 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant