Skip to content

Instantly share code, notes, and snippets.

@mattn
Created September 18, 2018 15:54
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/4187a786aea839cb334a6bc3bf88c3c2 to your computer and use it in GitHub Desktop.
Save mattn/4187a786aea839cb334a6bc3bf88c3c2 to your computer and use it in GitHub Desktop.
FROM golang:1.9-alpine as base
WORKDIR /usr/src
COPY . .
RUN apk add git
RUN CGO_ENABLED=0 go get -d -ldflags "-s -w" .
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o main
FROM scratch
COPY --from=base /usr/src/main /go-http-microservice
CMD ["/go-http-microservice"]
package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
func main() {
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":3000"))
}
{
"public": true,
"features": {
"cloud": "v2"
},
"alias": ["buildx.ml", "mattn"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment