mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #893 from derekwaynecarr/kubernetes_hello_world
Add small image to use for e2e-testing and getting started examples
This commit is contained in:
commit
ad8e853e82
4
build/hello-kubernetes/Dockerfile
Normal file
4
build/hello-kubernetes/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM scratch
|
||||||
|
ADD hello /
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT ["/hello"]
|
18
build/hello-kubernetes/hello.go
Normal file
18
build/hello-kubernetes/hello.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func helloFromKubernetes(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintln(w, "Hello World! -- Kubernetes")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/", helloFromKubernetes)
|
||||||
|
err := http.ListenAndServe(":8080", nil)
|
||||||
|
if err != nil {
|
||||||
|
panic("ListenAndServe: " + err.Error())
|
||||||
|
}
|
||||||
|
}
|
6
build/hello-kubernetes/prepare.sh
Executable file
6
build/hello-kubernetes/prepare.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static" -s' hello.go
|
Loading…
Reference in New Issue
Block a user