Created
July 9, 2018 17:47
-
-
Save imjasonh/f1fb27779bc17009198e2cef946bf749 to your computer and use it in GitHub Desktop.
This file contains 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
FROM golang:latest | |
RUN mkdir /app | |
ADD . /app/ | |
WORKDIR /app | |
RUN go build -o helloworld . | |
CMD ["/app/helloworld"] |
This file contains 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
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