Skip to content

Instantly share code, notes, and snippets.

@imjasonh
Created July 9, 2018 17:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save imjasonh/f1fb27779bc17009198e2cef946bf749 to your computer and use it in GitHub Desktop.
Save imjasonh/f1fb27779bc17009198e2cef946bf749 to your computer and use it in GitHub Desktop.
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o helloworld .
CMD ["/app/helloworld"]
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
log.Print("Hello world received a request.")
fmt.Fprintln(w, "Hello World! How about some tasty noodles?")
}
func main() {
flag.Parse()
log.Print("Hello world app started.")
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment