Skip to content

afxcn/goruntime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

minimal runtime for golang app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published