Last active
May 30, 2018 17:48
-
-
Save DazWilkin/d4fac48b810fb646384e2d422c81ac13 to your computer and use it in GitHub Desktop.
Dockerfile Go HEALTHCHECKs & K8s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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