Skip to content

Commit

Permalink
merge from x/gorm
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Aug 24, 2024
2 parents 6dc328d + 948681a commit a4f6ac2
Show file tree
Hide file tree
Showing 143 changed files with 4,111 additions and 4,092 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.allinone
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion auto/api/m/v1/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/r/v1/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/s/v1/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion auto/api/v1/admin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/alipay_priv.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/alipay_pub.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/core.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/followship.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions auto/api/v1/friendship.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/loose.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/priv.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/pub.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/relax.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/site.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/v1/trends.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auto/api/x/v1/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions build-allinone.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<title>paopao-ce develop documents</title>
<!-- Important: rapi-doc uses utf8 charecters -->
<!-- Important: rapi-doc uses utf8 characters -->
<script
type="module"
src="/docs/openapi/assets/rapidoc-min.js"
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"type": "string"
},
"in": "header",
"description": "A set of `,` seperated content-types that could be sent as a response.\nE.g. `image/png,image/webp,image/gif`",
"description": "A set of `,` separated content-types that could be sent as a response.\nE.g. `image/png,image/webp,image/gif`",
"required": false,
"deprecated": false
}
Expand Down
Loading

0 comments on commit a4f6ac2

Please sign in to comment.