latestwhich happens to be
go 1.6.4-r2from the Alpine package repo.
How to Use This Container
The working directory is
/opt/go/ within which there are two directories:
src/ and 'bin/'. The best way to use this container is to run it with two volumes configured:
- A volume that mounts wherever you want the compiled #golang bits to go.
- A volume that mounts wherever you have your
go/src/directory with the code you want to compile.
Example 1: Build your own Go program for Alpine Linux
Assuming you have two directories,
/home/ME/go/src/where you do your local #golang development, and
/home/ME/alpine/go/which you have created to hold your Alpine Linux-specific binaries,
- and you have a #golang program in the source directory
Run the following
docker command to compile your program so that the compiled binary
hello ends up in
docker run --rm --name alpinegodev \ -v /home/ME/alpine/go/:/opt/go \ -v /home/ME/go/src/:/opt/go/src \ methinksnot/alpine-go \ go install -v example/hello
If the compile succeeds without errors, you will find the
hello binary in your