Sign inSign up

afxcn/goruntime

By afxcn

Updated over 9 years ago

a minimal runtime for golang app base on centos 7.

Image
0

10K+

afxcn/goruntime repository overview

goruntime

a minimal runtime for golang app base on centos 7.

create main.go

package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "os"
)

func main() {
    resp, err := http.Get("https://google.com")
    check(err)
    body, err := ioutil.ReadAll(resp.Body)
    check(err)
    fmt.Println(len(body))
}

func check(err error) {
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

build it:

GOOS=linux go build -o main .

create Dockerfile

FROM afxcn/goruntime
ADD main /
CMD ["/main"]

build it

docker build -t afxcn/hello-go .

run it

docker run afxcn/hello-go

Tag summary

Content type

Image

Digest

Size

1.3 MB

Last updated

over 9 years ago

docker pull afxcn/goruntime