Add docker cross compilation instructions (#12931)
This commit is contained in:
parent
587b50fc43
commit
74710ae71a
10
README.md
10
README.md
|
@ -152,3 +152,13 @@ $ tree ./pkg/ -P "terraform|*.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
_Note: Cross-compilation uses [gox](https://github.com/mitchellh/gox), which requires toolchains to be built with versions of Go prior to 1.5. In order to successfully cross-compile with older versions of Go, you will need to run `gox -build-toolchain` before running the commands detailed above._
|
_Note: Cross-compilation uses [gox](https://github.com/mitchellh/gox), which requires toolchains to be built with versions of Go prior to 1.5. In order to successfully cross-compile with older versions of Go, you will need to run `gox -build-toolchain` before running the commands detailed above._
|
||||||
|
|
||||||
|
#### Docker
|
||||||
|
|
||||||
|
When using docker you don't need to have any of the Go development tools installed and you can clone terraform to any location on disk (doesn't have to be in your $GOPATH). This is useful for users who want to build `master` or a specific branch for testing without setting up a proper Go environment.
|
||||||
|
|
||||||
|
For example, run the following command to build terraform in a linux-based container for macOS.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run --rm -v $(pwd):/go/src/github.com/hashicorp/terraform -w /go/src/github.com/hashicorp/terraform -e XC_OS=darwin -e XC_ARCH=amd64 golang:latest bash -c "apt-get update && apt-get install -y zip && make bin"
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue