Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
soup-zhang committed Aug 13, 2019
1 parent 56605fa commit a70dc8e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
*.idea


15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:latest as build-env

ENV GO111MODULE=on
ENV BUILDPATH=github.com/soup-zhang/soup-hello
#ENV GOPROXY=goproxy.io
ENV GOPATH=/go
RUN mkdir -p /go/src/${BUILDPATH}
COPY ./ /go/src/${BUILDPATH}
RUN cd /go/src/${BUILDPATH} && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -v

FROM alpine:latest

COPY --from=build-env /go/bin/soup-hello /go/bin/soup-hello
WORKDIR /go/bin/
CMD ["/go/bin/soup-hello"]
23 changes: 23 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @Time : 2019-08-13 10:41
* @Author : soupzhb@gmail.com
* @File : main.go
* @Software: GoLand
*/

package main

import (
"fmt"
"html"
"log"
"net/http"
)

func main() {
fmt.Println("main start ...")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, _ = fmt.Fprintf(w, "Soup Hello, %q", html.EscapeString(r.URL.Path))
})
log.Fatal(http.ListenAndServe(":8080", nil))
}

0 comments on commit a70dc8e

Please # to comment.