Fixed the container name (#8)

* Fixed the container name
* whoamI -> whoami
This commit is contained in:
Gérald Croës
2018-08-06 17:05:34 +02:00
committed by Emile Vauge
parent c039b48727
commit 585d48ff07
5 changed files with 9 additions and 9 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/whoamI /whoami

View File

@ -1,5 +1,5 @@
# Create a minimal container to run a Golang static binary # Create a minimal container to run a Golang static binary
FROM scratch FROM scratch
COPY whoamI / COPY whoami /
ENTRYPOINT ["/whoamI"] ENTRYPOINT ["/whoami"]
EXPOSE 80 EXPOSE 80

View File

@ -1,9 +1,9 @@
# whoamI # whoami
Tiny Go webserver that prints os information and HTTP request to output Tiny Go webserver that prints os information and HTTP request to output
```sh ```sh
$ docker run -d -P --name iamfoo emilevauge/whoami $ docker run -d -P --name iamfoo containous/whoami
$ docker inspect --format '{{ .NetworkSettings.Ports }}' iamfoo $ docker inspect --format '{{ .NetworkSettings.Ports }}' iamfoo
map[80/tcp:[{0.0.0.0 32769}]] map[80/tcp:[{0.0.0.0 32769}]]
$ curl "http://0.0.0.0:32769" $ curl "http://0.0.0.0:32769"

4
app.go
View File

@ -34,7 +34,7 @@ func main() {
flag.Parse() flag.Parse()
http.HandleFunc("/echo", echoHandler) http.HandleFunc("/echo", echoHandler)
http.HandleFunc("/bench", benchHandler) http.HandleFunc("/bench", benchHandler)
http.HandleFunc("/", whoamI) http.HandleFunc("/", whoami)
http.HandleFunc("/api", api) http.HandleFunc("/api", api)
http.HandleFunc("/health", healthHandler) http.HandleFunc("/health", healthHandler)
fmt.Println("Starting up on port " + port) fmt.Println("Starting up on port " + port)
@ -75,7 +75,7 @@ func echoHandler(w http.ResponseWriter, r *http.Request) {
} }
} }
func whoamI(w http.ResponseWriter, req *http.Request) { func whoami(w http.ResponseWriter, req *http.Request) {
u, _ := url.Parse(req.URL.String()) u, _ := url.Parse(req.URL.String())
queryParams := u.Query() queryParams := u.Query()
wait := queryParams.Get("wait") wait := queryParams.Get("wait")

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o whoamI CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o whoami
docker build -t emilevauge/whoami . docker build -t containous/whoami .