Skip to content

pierredavidbelanger/golang-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

golang-tool

A tool to compile a Golang application and package it in a minimal Docker container.

Heavily inspired by CenturyLinkLabs/golang-builder.

usage

Create a project folder

$ mkdir /tmp/hello && cd /tmp/hello

Create an Hello world application

$ cat <<EOF > hello-world.go
package main // import "github.com/pierredavidbelanger/hello"
import "fmt"
func main() {
    fmt.Println("hello world")
}
EOF

Compile and package it

$ docker run --rm \
    -v $PWD:/src \
    -v /var/run/docker.sock:/var/run/docker.sock \
    pierredavidbelanger/golang-tool \
    build

Appreciate its size

$ docker images
REPOSITORY                           TAG                 IMAGE ID            CREATED              SIZE
hello                                latest              45cc1f1f326f        About a minute ago   1.3 MB
pierredavidbelanger/golang-tool      latest              98dbd68d4fe4        15 minutes ago       830 MB

Run it

$ docker run --rm hello
hello world

About

Compile and package Golang application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages