tcnksm/gox Repository | Docker Hub Registry - Repositories of Docker Images
Dockerfile for Cross-compiling golang project with mitchellh/gox.
docker-library/golang (Docker official golang stack) also support image for cross-compile. With Dockerfile-gox
, You can cross-compile your golang project parallelly. It's more fast when compiling for multiple platform.
tcnksm/gox
image support below tags. Link is its Dockerfile
.
1.2
(1.2/Dockerfile)1.2.1
(1.2.1/Dockerfile)1.2.2
(1.2.2/Dockerfile)1.3
(1.3/Docekerfile)1.3.1
(1.3.1/Dockerfile)
Tag is correspond to its golang version.
If you want to cross-compile with go v1.3.1:
$ docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp tcnksm/gox:1.3.1
Or if you want to cross-compile with go v1.2:
$ docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp tcnksm/gox:1.2
You can overwrite command. If you have Makefile with gox
:
$ docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp tcnksm/gox:1.3.1 make
Or if you want to build for 64-bit linux and change output to pkg
directory with your favor name:
$ docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp tcnksm/gox:1.3.1 gox -osarch="linux/amd64" -output "pkg/{{.OS}}_{{.Arch}}/{{.Dir}}"
If you want to know gox
arguments more, See documents in mitchellh/gox.
- Fork (https://github.com/tcnksm/dockerfile-gox/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Push it to your remote repository
- Create new Pull Request