diff --git a/Dockerfile b/Dockerfile index 345ba15a8..5b2ea3c96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,9 +22,9 @@ ARG USE_DIST=no WORKDIR /paopao-ce COPY . . COPY --from=frontend /web/dist ./web/dist -ENV GOPROXY=https://goproxy.cn -RUN [ $EMBED_UI != yes ] || make build TAGS='go_json' -RUN [ $EMBED_UI = yes ] || make build TAGS='slim embed go_json' +ENV GOPROXY=https://goproxy.cn,direct +RUN --mount=type=cache,target=$GOPATH/go/pkg,id=paopao-ce-gopkg [ $EMBED_UI != yes ] || make buildx TAGS='go_json' +RUN --mount=type=cache,target=$GOPATH/go/pkg,id=paopao-ce-gopkg [ $EMBED_UI = yes ] || make buildx TAGS='slim embed go_json' FROM bitbus/paopao-ce-backend-runner:latest ARG API_HOST diff --git a/Dockerfile.allinone b/Dockerfile.allinone index 1624b2b9e..efe4be4b3 100644 --- a/Dockerfile.allinone +++ b/Dockerfile.allinone @@ -22,9 +22,9 @@ ARG USE_DIST=no WORKDIR /paopao-ce COPY . . COPY --from=frontend /web/dist ./web/dist -ENV GOPROXY=https://goproxy.cn -RUN [ $EMBED_UI != yes ] || make build TAGS='go_json migration' -RUN [ $EMBED_UI = yes ] || make build TAGS='slim embed go_json migration' +ENV GOPROXY=https://goproxy.cn,direct +RUN --mount=type=cache,target=$GOPATH/go/pkg,id=paopao-ce-gopkg [ $EMBED_UI != yes ] || make buildx TAGS='go_json migration' +RUN --mount=type=cache,target=$GOPATH/go/pkg,id=paopao-ce-gopkg [ $EMBED_UI = yes ] || make buildx TAGS='slim embed go_json migration' FROM bitbus/paopao-ce-allinone-runner:latest ARG API_HOST diff --git a/Makefile b/Makefile index c66e8c978..5dedcec02 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ LDFLAGS = -X "${MOD_NAME}/pkg/version.version=${BUILD_VERSION}" \ all: fmt build build: + @echo Build paopao-ce + @go build -pgo=auto -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_ROOT)/$(TARGET) + +buildx: @go mod download @echo Build paopao-ce @go build -pgo=auto -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_ROOT)/$(TARGET) diff --git a/auto/api/m/v1/user.go b/auto/api/m/v1/user.go index 45d7fbba3..bea939a4e 100644 --- a/auto/api/m/v1/user.go +++ b/auto/api/m/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/r/v1/user.go b/auto/api/r/v1/user.go index 8c385f149..82850dc25 100644 --- a/auto/api/r/v1/user.go +++ b/auto/api/r/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/s/v1/user.go b/auto/api/s/v1/user.go index a876f6b76..ac25628d9 100644 --- a/auto/api/s/v1/user.go +++ b/auto/api/s/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/admin.go b/auto/api/v1/admin.go index 4c3af4484..b3c208c7a 100644 --- a/auto/api/v1/admin.go +++ b/auto/api/v1/admin.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 @@ -22,6 +22,7 @@ type _render_ interface { type _default_ interface { Bind(*gin.Context, any) mir.Error + BindJson(*gin.Context, any) mir.Error Render(*gin.Context, any, mir.Error) } diff --git a/auto/api/v1/alipay_priv.go b/auto/api/v1/alipay_priv.go index 3c3ee1f50..86669b89d 100644 --- a/auto/api/v1/alipay_priv.go +++ b/auto/api/v1/alipay_priv.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/alipay_pub.go b/auto/api/v1/alipay_pub.go index e1c3e8b79..f4bbde516 100644 --- a/auto/api/v1/alipay_pub.go +++ b/auto/api/v1/alipay_pub.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/core.go b/auto/api/v1/core.go index 911445ab0..cd5647363 100644 --- a/auto/api/v1/core.go +++ b/auto/api/v1/core.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/followship.go b/auto/api/v1/followship.go index c0041feb0..f1787fc46 100644 --- a/auto/api/v1/followship.go +++ b/auto/api/v1/followship.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/friendship.go b/auto/api/v1/friendship.go index 6165822bd..787479332 100644 --- a/auto/api/v1/friendship.go +++ b/auto/api/v1/friendship.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 @@ -56,7 +56,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.DeleteFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } @@ -69,7 +69,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.RejectFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } @@ -82,7 +82,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.AddFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } @@ -95,7 +95,7 @@ func RegisterFriendshipServant(e *gin.Engine, s Friendship) { default: } req := new(web.RequestingFriendReq) - if err := s.Bind(c, req); err != nil { + if err := s.BindJson(c, req); err != nil { s.Render(c, nil, err) return } diff --git a/auto/api/v1/loose.go b/auto/api/v1/loose.go index dbf598d21..80d4f4aeb 100644 --- a/auto/api/v1/loose.go +++ b/auto/api/v1/loose.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/priv.go b/auto/api/v1/priv.go index a8f46943e..a48ef256d 100644 --- a/auto/api/v1/priv.go +++ b/auto/api/v1/priv.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/pub.go b/auto/api/v1/pub.go index 98a41440b..28abcb469 100644 --- a/auto/api/v1/pub.go +++ b/auto/api/v1/pub.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/relax.go b/auto/api/v1/relax.go index bc24486cc..65aac2aa5 100644 --- a/auto/api/v1/relax.go +++ b/auto/api/v1/relax.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/site.go b/auto/api/v1/site.go index 3ec9fcc79..ba523c2da 100644 --- a/auto/api/v1/site.go +++ b/auto/api/v1/site.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/v1/trends.go b/auto/api/v1/trends.go index cce1b7399..959fa317f 100644 --- a/auto/api/v1/trends.go +++ b/auto/api/v1/trends.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/auto/api/x/v1/user.go b/auto/api/x/v1/user.go index bf2e84a48..a6ae9a588 100644 --- a/auto/api/x/v1/user.go +++ b/auto/api/x/v1/user.go @@ -1,6 +1,6 @@ // Code generated by go-mir. DO NOT EDIT. // versions: -// - mir v4.1.0 +// - mir v4.2.0 package v1 diff --git a/build-allinone.sh b/build-allinone.sh new file mode 100755 index 000000000..06353b81a --- /dev/null +++ b/build-allinone.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# eg.1 : sh build-image.sh +# eg.2, set image: sh build-image.sh bitbus/paopao-ce + +VERSION=`git describe --tags --always | cut -f1,2 -d "-"` # eg.: 0.2.5 +IMAGE="bitbus/paopao-ce" + +if [ -n "$1" ]; then + IMAGE="$1" +fi +if [ -n "$2" ]; then + VERSION="$2" +fi + +# build image +docker buildx build \ + --build-arg USE_DIST="yes" \ + --tag "$IMAGE:all-in-one-${VERSION}" \ + --tag "$IMAGE:all-in-one-latest" \ + . -f Dockerfile.allinone + +# push to image rep +# if [ -n "$1" ]; then +# docker push "$IMAGE:${VERSION}" +# docker push "$IMAGE:latest" +# fi diff --git a/docker-compose.yaml b/docker-compose.yaml index b3271bba7..7135f52c1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -67,7 +67,7 @@ services: # - paopao-network meili: - image: getmeili/meilisearch:${MEILI_TAG:-v1.6} + image: getmeili/meilisearch:${MEILI_TAG:-v1.7} restart: always ports: - 7700:7700 diff --git a/docs/openapi/index.html b/docs/openapi/index.html index cec190fec..2a30394d6 100644 --- a/docs/openapi/index.html +++ b/docs/openapi/index.html @@ -5,7 +5,7 @@ paopao-ce develop documents - +