From 0e66a62615741f602d46fa1d86ccfd2018c91218 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Fri, 9 Jan 2015 10:53:37 +1100 Subject: [PATCH] cmd/tipgodoc: simplify Dockerfile and fix deployment Change-Id: Ib2fd1346255467cb790a9e4c37d25f8e8ca136f5 Reviewed-on: https://go-review.googlesource.com/2534 Reviewed-by: Brad Fitzpatrick --- cmd/tipgodoc/Dockerfile | 19 +++++++------------ cmd/tipgodoc/README | 3 +++ cmd/tipgodoc/app.yaml | 1 - cmd/tipgodoc/tip.go | 5 ++--- 4 files changed, 12 insertions(+), 16 deletions(-) create mode 100644 cmd/tipgodoc/README diff --git a/cmd/tipgodoc/Dockerfile b/cmd/tipgodoc/Dockerfile index 09bd9328..171e43d7 100644 --- a/cmd/tipgodoc/Dockerfile +++ b/cmd/tipgodoc/Dockerfile @@ -1,14 +1,9 @@ -FROM google/appengine-go +FROM golang -RUN apt-get update -RUN apt-get install --no-install-recommends -y -q curl build-essential git -RUN mkdir /goroot && curl https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1 -RUN mkdir /gopath +RUN apt-get update && apt-get install --no-install-recommends -y -q build-essential git -ENV GOROOT /goroot -ENV GOPATH /gopath -ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin - -WORKDIR /app -ADD . /app -RUN /bin/bash /app/_ah/build.sh +# golang sets GOPATH=/go +ADD . /go/src/tipgodoc +RUN go install tipgodoc +ENTRYPOINT ["/go/bin/tipgodoc"] +EXPOSE 8080 # what kubernetes expects diff --git a/cmd/tipgodoc/README b/cmd/tipgodoc/README new file mode 100644 index 00000000..5feead7e --- /dev/null +++ b/cmd/tipgodoc/README @@ -0,0 +1,3 @@ +To deploy as an App Engine Manged VM, use gcloud: + + $ gcloud preview app deploy . diff --git a/cmd/tipgodoc/app.yaml b/cmd/tipgodoc/app.yaml index 186c3040..59e5a06f 100644 --- a/cmd/tipgodoc/app.yaml +++ b/cmd/tipgodoc/app.yaml @@ -13,4 +13,3 @@ handlers: health_check: enable_health_check: False - diff --git a/cmd/tipgodoc/tip.go b/cmd/tipgodoc/tip.go index b0b75810..61fe38e8 100644 --- a/cmd/tipgodoc/tip.go +++ b/cmd/tipgodoc/tip.go @@ -2,8 +2,6 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. -// +build appenginevm - // Command tipgodoc is the beginning of the new tip.golang.org server, // serving the latest HEAD straight from the Git oven. package main @@ -30,10 +28,11 @@ const ( metaURL = "https://go.googlesource.com/?b=master&format=JSON" ) -func init() { +func main() { p := new(Proxy) go p.run() http.Handle("/", p) + log.Fatal(http.ListenAndServe(":8080", nil)) } type Proxy struct {