Skip to content

Instantly share code, notes, and snippets.

@pwillis-els
Created January 15, 2020 01:52
Show Gist options
  • Save pwillis-els/fac40df5eca10c247522a07d83a89c80 to your computer and use it in GitHub Desktop.
Save pwillis-els/fac40df5eca10c247522a07d83a89c80 to your computer and use it in GitHub Desktop.
Building Go software in Docker

(this can probably be greatly improved...)

Run the following command to enter a Docker container with a Go environment set up:

$ docker run --rm -it -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.8 bash

Inside the container, run the 'go get' command for the software you want to build and install:

root@3aac13b2bce8:/usr/src/myapp#  go get github.com/itchio/gothub

Copy the binary into your working directory, fixing the permissions and ownership:

root@3aac13b2bce8:/usr/src/myapp#  install -m 755 -o 1000 -g 1000 /go/bin/gothub .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment