diff --git a/contrib/for-demos/test-webserver/Makefile b/contrib/for-demos/test-webserver/Makefile deleted file mode 100644 index 84345d107d..0000000000 --- a/contrib/for-demos/test-webserver/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: push - -test-webserver: test-webserver.go - CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' ./test-webserver.go - -container: test-webserver - sudo docker build -t kubernetes/test-webserver . - -push: container - sudo docker push kubernetes/test-webserver - -clean: - rm -f test-webserver diff --git a/contrib/for-demos/test-webserver/test-webserver.go b/contrib/for-demos/test-webserver/test-webserver.go deleted file mode 100644 index b6e9573394..0000000000 --- a/contrib/for-demos/test-webserver/test-webserver.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// A tiny web server that serves a static file. -package main - -import ( - "flag" - "fmt" - "log" - "net/http" -) - -var ( - port = flag.Int("port", 80, "Port number.") -) - -func main() { - flag.Parse() - - fs := http.StripPrefix("/", http.FileServer(http.Dir("/"))) - - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Cache-Control", "private") - w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Access-Control-Allow-Credentials", "true") - w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS") - w.Header().Set("Access-Control-Allow-Headers", "DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type") - fs.ServeHTTP(w, r) - }) - - go log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)) - - select {} -} diff --git a/examples/update-demo/0-build-images.sh b/examples/update-demo/0-build-images.sh index c07a3acaae..d6e7e946ca 100755 --- a/examples/update-demo/0-build-images.sh +++ b/examples/update-demo/0-build-images.sh @@ -27,6 +27,7 @@ fi set -x +docker build -t update-demo-base images/base docker build -t "${DOCKER_HUB_USER}/update-demo:kitten" images/kitten docker build -t "${DOCKER_HUB_USER}/update-demo:nautilus" images/nautilus diff --git a/contrib/for-demos/test-webserver/Dockerfile b/examples/update-demo/images/base/Dockerfile similarity index 77% rename from contrib/for-demos/test-webserver/Dockerfile rename to examples/update-demo/images/base/Dockerfile index 275b710de9..428a708a54 100644 --- a/contrib/for-demos/test-webserver/Dockerfile +++ b/examples/update-demo/images/base/Dockerfile @@ -12,8 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM scratch -MAINTAINER David Oppenheimer -ADD test-webserver test-webserver -EXPOSE 80 -ENTRYPOINT ["/test-webserver"] +FROM dockerfile/nginx + +ADD default /etc/nginx/sites-available/default + +ONBUILD ADD html /usr/share/nginx/html +ONBUILD RUN chmod -R a+r /usr/share/nginx/html + +CMD ["nginx"] diff --git a/examples/update-demo/images/base/default b/examples/update-demo/images/base/default new file mode 100644 index 0000000000..03b952faef --- /dev/null +++ b/examples/update-demo/images/base/default @@ -0,0 +1,37 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +server { + listen 80 default_server; + listen [::]:80 default_server ipv6only=on; + + root /usr/share/nginx/html; + index index.html index.htm; + + # Make site accessible from http://localhost/ + server_name localhost; + + location / { + try_files $uri $uri/ =404; + expires 0; + add_header Cache-Control private; + + if ($request_method = 'GET') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Credentials' 'true'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; + } + } +} diff --git a/examples/update-demo/images/kitten/Dockerfile b/examples/update-demo/images/kitten/Dockerfile index ea142cbc19..f6de6de1a2 100644 --- a/examples/update-demo/images/kitten/Dockerfile +++ b/examples/update-demo/images/kitten/Dockerfile @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM kubernetes/test-webserver -ADD html/data.json html/kitten.jpg / +FROM update-demo-base diff --git a/examples/update-demo/images/nautilus/Dockerfile b/examples/update-demo/images/nautilus/Dockerfile index eb7115d0e2..f6de6de1a2 100644 --- a/examples/update-demo/images/nautilus/Dockerfile +++ b/examples/update-demo/images/nautilus/Dockerfile @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM kubernetes/test-webserver -ADD html/data.json html/nautilus.jpg / +FROM update-demo-base diff --git a/hack/e2e-suite/update.sh b/hack/e2e-suite/update.sh index 7d6728d776..9930dbc4e1 100755 --- a/hack/e2e-suite/update.sh +++ b/hack/e2e-suite/update.sh @@ -102,6 +102,8 @@ function validate() { return 0 } +export DOCKER_HUB_USER=jbeda + # Launch a container ${KUBE_ROOT}/examples/update-demo/2-create-replication-controller.sh