Created
September 18, 2018 15:54
-
-
Save mattn/4187a786aea839cb334a6bc3bf88c3c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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