diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c24bc82 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.12.1-alpine3.9 +ENV GOPATH="/go" +RUN ["mkdir", "-p", "/go/src/github.com/rancher/demo"] +COPY * /go/src/github.com/rancher/demo/ +WORKDIR /go/src/github.com/rancher/demo +RUN ["go", "build", "-o", "demo"] +CMD ["./demo"] diff --git a/main.go b/main.go new file mode 100644 index 0000000..0004a84 --- /dev/null +++ b/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "time" +) + +func handler(w http.ResponseWriter, r *http.Request) { + // Arbitrary sleep so that we can demonstrate autoscaler + log.Println("Basic logging -- request received") + time.Sleep(51 * time.Millisecond) + fmt.Fprintln(w, "Stampede 2020 Demo: Initial Commit") +} + +func main() { + http.HandleFunc("/", handler) + log.Fatal(http.ListenAndServe(":8080", nil)) +}