ci/cd调整

This commit is contained in:
2026-06-10 15:51:41 +08:00
parent fa297939e0
commit 3f81d5d91b
19 changed files with 31 additions and 53 deletions

View File

@@ -1,44 +1,24 @@
# 阶段构建 - 第一阶段:编译(使用已安装的镜像) # 阶段1: 构建
FROM golang:1.26-alpine3.23 AS builder FROM golang:alpine AS builder
RUN apk add --no-cache git ca-certificates tzdata RUN apk add --no-cache git ca-certificates tzdata
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV GO111MODULE=on ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
ENV GOTOOLCHAIN=auto ENV GOTOOLCHAIN=auto
ENV GOPRIVATE=gitea.com/red-future/common
# 配置git使用私有Gitea仓库带Token认证
RUN git config --global url."http://x-token-auth:619679cd366aefea3a50f0622d842a41f2209e08595767bba49c3836ef57d415@116.204.74.41:3000/red-future/common.git".insteadOf "https://gitea.com/red-future/common.git" && \
git config --global credential.helper store
WORKDIR /build WORKDIR /build
# 复制父目录的 common 模块(因为 go.mod 中使用了本地 replace)
#COPY ../common /build/common
COPY . . COPY . .
RUN go mod download && go mod tidy RUN go mod download && go mod tidy
RUN go build -ldflags="-s -w" -o main ./main.go RUN go build -ldflags="-s -w" -o main ./main.go
# 第二阶段:运行
FROM alpine:3.23
ENV TIME_ZONE=Asia/Shanghai EXPOSE 3012
RUN apk add --no-cache ca-certificates tzdata && \
ln -sf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime
WORKDIR /app
# 复制编译好的二进制文件
COPY --from=builder /build/main .
COPY --from=builder /build/config.yml ./
# 创建日志目录
RUN mkdir -p /logs /app/resource/log/run /app/resource/log/server
EXPOSE 3000
CMD ["./main"] CMD ["./main"]

View File

@@ -1,5 +1,5 @@
server: server:
address: ":3000" address: ":3012"
name: "customer-server" name: "customer-server"
cache: cache:
localTTL: 60 localTTL: 60

View File

@@ -7,7 +7,7 @@ import (
"customer-server/model/dto" "customer-server/model/dto"
"customer-server/service" "customer-server/service"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
) )

View File

@@ -7,7 +7,7 @@ import (
"customer-server/model/dto" "customer-server/model/dto"
"customer-server/service" "customer-server/service"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
) )

View File

@@ -7,7 +7,7 @@ import (
"customer-server/model/dto" "customer-server/model/dto"
"customer-server/service" "customer-server/service"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
) )

View File

@@ -6,7 +6,7 @@ import (
"customer-server/model/dto" "customer-server/model/dto"
"customer-server/model/entity" "customer-server/model/entity"
"gitea.com/red-future/common/db/gfdb" "gitea.redpowerfuture.com/red-future/common/db/gfdb"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
) )

View File

@@ -6,7 +6,7 @@ import (
"customer-server/model/dto" "customer-server/model/dto"
"customer-server/model/entity" "customer-server/model/entity"
"gitea.com/red-future/common/db/gfdb" "gitea.redpowerfuture.com/red-future/common/db/gfdb"
"github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
) )

View File

@@ -6,7 +6,7 @@ import (
"customer-server/model/dto" "customer-server/model/dto"
"customer-server/model/entity" "customer-server/model/entity"
"gitea.com/red-future/common/db/gfdb" "gitea.redpowerfuture.com/red-future/common/db/gfdb"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
) )

4
go.mod
View File

@@ -2,12 +2,10 @@ module customer-server
go 1.26.0 go 1.26.0
//replace gitea.com/red-future/common v0.0.18 => ../common
//replace github.com/bjang03/gmq => ../gmq //replace github.com/bjang03/gmq => ../gmq
require ( require (
gitea.com/red-future/common v0.0.18 gitea.redpowerfuture.com/red-future/common v0.0.23
github.com/bjang03/gmq v0.0.1 github.com/bjang03/gmq v0.0.1
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.10.0 github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.10.0
github.com/gogf/gf/contrib/nosql/redis/v2 v2.10.0 github.com/gogf/gf/contrib/nosql/redis/v2 v2.10.0

4
go.sum
View File

@@ -1,6 +1,6 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
gitea.com/red-future/common v0.0.18 h1:RwpnnWmDTCnFtKfmlp9BOnDd4r9eUnx7YT6Zst3VJqY= gitea.redpowerfuture.com/red-future/common v0.0.23 h1:xieoA00iKOCDm5SO9iXn+cSyMKBAlZwI0fuEVPWrHLg=
gitea.com/red-future/common v0.0.18/go.mod h1:6/nqIucVzmjOyqDTIq71feYBXXFNBy0rFwzaQ0/Ueoo= gitea.redpowerfuture.com/red-future/common v0.0.23/go.mod h1:50U1Xi+Ie56z09S5LQbZvaken0Mxv3OeS9LgR7U/ZRY=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=

View File

@@ -9,9 +9,9 @@ import (
"os/signal" "os/signal"
"syscall" "syscall"
"gitea.com/red-future/common/http" "gitea.redpowerfuture.com/red-future/common/http"
"gitea.com/red-future/common/jaeger" "gitea.redpowerfuture.com/red-future/common/jaeger"
"gitea.com/red-future/common/utils" "gitea.redpowerfuture.com/red-future/common/utils"
gmq "github.com/bjang03/gmq/core/gmq" gmq "github.com/bjang03/gmq/core/gmq"
"github.com/bjang03/gmq/mq" "github.com/bjang03/gmq/mq"
"github.com/bjang03/gmq/types" "github.com/bjang03/gmq/types"

View File

@@ -5,7 +5,7 @@ package dto
import ( import (
"customer-server/consts/account" "customer-server/consts/account"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
) )

View File

@@ -5,7 +5,7 @@ package dto
import ( import (
"customer-server/consts/scriptedSpeech" "customer-server/consts/scriptedSpeech"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
) )

View File

@@ -1,7 +1,7 @@
package dto package dto
import ( import (
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
) )

View File

@@ -3,7 +3,7 @@ package entity
import ( import (
"customer-server/consts/account" "customer-server/consts/account"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
) )
type accountCol struct { type accountCol struct {

View File

@@ -1,7 +1,7 @@
package entity package entity
import ( import (
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
) )
type accountUserDialogCol struct { type accountUserDialogCol struct {

View File

@@ -3,7 +3,7 @@ package entity
import ( import (
"customer-server/consts/scriptedSpeech" "customer-server/consts/scriptedSpeech"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
) )
type scriptedSpeechCol struct { type scriptedSpeechCol struct {

View File

@@ -7,8 +7,8 @@ import (
"fmt" "fmt"
netHttp "net/http" netHttp "net/http"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"gitea.com/red-future/common/jaeger" "gitea.redpowerfuture.com/red-future/common/jaeger"
"github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gmap"
"github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"

View File

@@ -14,10 +14,10 @@ import (
"strings" "strings"
"time" "time"
"gitea.com/red-future/common/beans" "gitea.redpowerfuture.com/red-future/common/beans"
"gitea.com/red-future/common/http" "gitea.redpowerfuture.com/red-future/common/http"
"gitea.com/red-future/common/jaeger" "gitea.redpowerfuture.com/red-future/common/jaeger"
"gitea.com/red-future/common/utils" "gitea.redpowerfuture.com/red-future/common/utils"
gmq "github.com/bjang03/gmq/core/gmq" gmq "github.com/bjang03/gmq/core/gmq"
"github.com/bjang03/gmq/mq" "github.com/bjang03/gmq/mq"
"github.com/bjang03/gmq/types" "github.com/bjang03/gmq/types"