diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cc8258dfe..feb3c4d9e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -47,7 +47,7 @@ jobs: name: Test strategy: matrix: - go-version: [ 1.21.x ] + go-version: [ 1.21.x, 1.22.x ] platform: [ ubuntu-latest, macos-latest ] runs-on: ${{ matrix.platform }} steps: @@ -66,7 +66,7 @@ jobs: name: TestOnWindows strategy: matrix: - go-version: [ 1.21.x ] + go-version: [ 1.21.x, 1.22.x ] platform: [ windows-latest ] runs-on: ${{ matrix.platform }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index f5e6d99a0..3b2f9eed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to paopao-ce are documented in this file. - add all-in-one docker image build scripts. - frontend: add tweets filter support use tag for home page and make it as default behavior. - add pin topic support. +- support upload webp format image as picture when send tweet. ## 0.5.2 ### Change diff --git a/Dockerfile b/Dockerfile index 345ba15a8..e98e5dcac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # build frontend -FROM node:19-alpine as frontend +FROM node:19-alpine AS frontend ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes @@ -12,17 +12,28 @@ RUN [ $EMBED_UI != yes ] || [ $USE_API_HOST != yes ] || echo "VITE_HOST='$API_HO RUN [ $EMBED_UI != yes ] || [ $USE_DIST != no ] || (yarn && yarn build) RUN [ $EMBED_UI = yes ] || mkdir dist || echo "" -# build backend -FROM bitbus/paopao-ce-backend-builder:latest AS backend +# build go mod cache +FROM bitbus/paopao-ce-backend-builder:latest AS gomodcache ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes ARG USE_DIST=no +ENV GOPROXY=https://goproxy.cn,direct +WORKDIR /paopao-ce +COPY go.mod . +COPY go.sum . +RUN go mod download +# build backend +FROM gomodcache AS backend +ARG API_HOST +ARG USE_API_HOST=yes +ARG EMBED_UI=yes +ARG USE_DIST=no WORKDIR /paopao-ce COPY . . COPY --from=frontend /web/dist ./web/dist -ENV GOPROXY=https://goproxy.cn +ENV GOPROXY=https://goproxy.cn,direct RUN [ $EMBED_UI != yes ] || make build TAGS='go_json' RUN [ $EMBED_UI = yes ] || make build TAGS='slim embed go_json' @@ -32,11 +43,9 @@ ARG USE_API_HOST=yes ARG EMBED_UI=yes ARG USE_DIST=no ENV TZ=Asia/Shanghai - WORKDIR /app/paopao-ce COPY --from=backend /paopao-ce/release/paopao . COPY --from=backend /paopao-ce/config.yaml.sample config.yaml - VOLUME ["/app/paopao-ce/custom"] EXPOSE 8008 HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD ps -ef | grep paopao || exit 1 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 33b32eca1..ecfc0d43f 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 885c31412..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 @@ -124,7 +124,7 @@ services: # - paopao-network backend: - image: bitbus/paopao-ce:${PAOPAOCE_TAG:-nightly} + image: bitbus/paopao-ce:${PAOPAOCE_TAG:-0.6-alpha} restart: always depends_on: - db 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 @@