Public | Automated Build

Last pushed: 3 months ago
Short Description
A tool to compile a Golang application and package it in a minimal Docker container.
Full Description

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
Docker Pull Command
Owner
pierredavidbelanger
Source Repository

Comments (0)