Skip to content

Instantly share code, notes, and snippets.

@DazWilkin
Last active May 30, 2018 17:48
Show Gist options
  • Save DazWilkin/d4fac48b810fb646384e2d422c81ac13 to your computer and use it in GitHub Desktop.
Save DazWilkin/d4fac48b810fb646384e2d422c81ac13 to your computer and use it in GitHub Desktop.
Dockerfile Go HEALTHCHECKs & K8s
// Derived closely from https://github.com/Soluto/golang-docker-healthcheck-example
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
if len(os.Args) < 2 {
log.Fatal("Expected URL as command-line argument")
os.Exit(1)
}
url := os.Args[1]
fmt.Println(url)
if _, err := http.Get(url); err != nil {
os.Exit(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment