update
This commit is contained in:
@@ -9,15 +9,15 @@ WORKDIR /go/src
|
||||
ADD . .
|
||||
RUN go mod tidy
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o api_example_api ./app/api/example_api
|
||||
FROM alpine as brahma-api
|
||||
|
||||
FROM alpine as example_api
|
||||
WORKDIR /go/src
|
||||
#LABEL maintainer "The Prometheus Authors <prometheus-developers@googlegroups.com>"
|
||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
# copy main and config from builder
|
||||
COPY --from=builder /go/src/api_example_api ./
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV env=pro
|
||||
ENV endpoints=http://etcd-server:2379
|
||||
RUN chmod +x ./api_example_api
|
||||
LABEL io.portainer.accesscontrol.teams="admin"
|
||||
EXPOSE 8080
|
||||
CMD ["./api_example_api"]
|
||||
@@ -1,15 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"git.icechen.cn/pkg/go-template/app/service/example_service/pkg/user"
|
||||
"context"
|
||||
"git.icechen.cn/pkg/go-template/pkg/proto/example_service"
|
||||
"git.icechen.cn/pkg/go-template/pkg/rpc"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
user.GetUser()
|
||||
app := fiber.New()
|
||||
app.Get("/test", func(c *fiber.Ctx) error {
|
||||
return c.SendString("success")
|
||||
userInfo, err := example_service.NewUserClient(rpc.GetServiceConn("example_service")).SayHello(context.TODO(), &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(userInfo)
|
||||
})
|
||||
err := app.Listen(":8080")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user