From 40abf0f60628001a550f325412458108c82aa383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=8C?= <259278618@qq.com> Date: Wed, 10 Jun 2026 16:32:42 +0800 Subject: [PATCH] =?UTF-8?q?ci/cd=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 28 ++++------------------- common/util/headers.go | 2 +- dao/compose_session_dao.go | 2 +- dao/compose_task_dao.go | 2 +- dao/provider_protocol_dao.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- main.go | 6 ++--- model/entity/prompts_compose_session.go | 2 +- model/entity/prompts_compose_task.go | 2 +- model/entity/prompts_provider_protocol.go | 2 +- service/gateway/gateway_http_service.go | 4 ++-- service/prompt/prompt_build_service.go | 2 +- service/prompt/prompt_compose_service.go | 4 ++-- service/session/prompt_session_service.go | 4 ++-- 15 files changed, 24 insertions(+), 44 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4b1cb3a..1e4bcc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,43 +1,23 @@ -# 多阶段构建 - 第一阶段:编译(使用已安装的镜像) +# 阶段1: 构建 FROM golang:alpine AS builder 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 GOPROXY=https://goproxy.cn,direct ENV CGO_ENABLED=0 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 -# 复制父目录的 common 模块(因为 go.mod 中使用了本地 replace) -#COPY ../common /build/common COPY . . RUN go mod download && go mod tidy RUN go build -ldflags="-s -w" -o main ./main.go -# 第二阶段:运行 -FROM alpine:3.19 - -ENV TIME_ZONE=Asia/Shanghai -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 3009 diff --git a/common/util/headers.go b/common/util/headers.go index 6eedffa..569f217 100644 --- a/common/util/headers.go +++ b/common/util/headers.go @@ -3,7 +3,7 @@ package util import ( "context" - "gitea.com/red-future/common/utils" + "gitea.redpowerfuture.com/red-future/common/utils" "github.com/gogf/gf/v2/frame/g" ) diff --git a/dao/compose_session_dao.go b/dao/compose_session_dao.go index b06831c..c890f20 100644 --- a/dao/compose_session_dao.go +++ b/dao/compose_session_dao.go @@ -5,7 +5,7 @@ import ( "prompts-core/consts/public" "prompts-core/model/entity" - "gitea.com/red-future/common/db/gfdb" + "gitea.redpowerfuture.com/red-future/common/db/gfdb" ) var ComposeSession = &composeSessionDao{} diff --git a/dao/compose_task_dao.go b/dao/compose_task_dao.go index 7e16018..9106ed2 100644 --- a/dao/compose_task_dao.go +++ b/dao/compose_task_dao.go @@ -5,7 +5,7 @@ import ( "prompts-core/consts/public" "prompts-core/model/entity" - "gitea.com/red-future/common/db/gfdb" + "gitea.redpowerfuture.com/red-future/common/db/gfdb" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/dao/provider_protocol_dao.go b/dao/provider_protocol_dao.go index e0b970d..00242e8 100644 --- a/dao/provider_protocol_dao.go +++ b/dao/provider_protocol_dao.go @@ -5,7 +5,7 @@ import ( "prompts-core/consts/public" "prompts-core/model/entity" - "gitea.com/red-future/common/db/gfdb" + "gitea.redpowerfuture.com/red-future/common/db/gfdb" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/go.mod b/go.mod index e9f4a1f..6529b97 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module prompts-core go 1.26.1 require ( - gitea.com/red-future/common v0.0.21 + gitea.redpowerfuture.com/red-future/common v0.0.23 github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.10.2 github.com/gogf/gf/contrib/nosql/redis/v2 v2.10.2 github.com/gogf/gf/v2 v2.10.2 diff --git a/go.sum b/go.sum index edd9261..53d628a 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -gitea.com/red-future/common v0.0.21 h1:8w30HmCVmFG/hphH3ODJs1KxDEGmRpq+/PXI0pQjJKc= -gitea.com/red-future/common v0.0.21/go.mod h1:6/nqIucVzmjOyqDTIq71feYBXXFNBy0rFwzaQ0/Ueoo= +gitea.redpowerfuture.com/red-future/common v0.0.23 h1:xieoA00iKOCDm5SO9iXn+cSyMKBAlZwI0fuEVPWrHLg= +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 v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= diff --git a/main.go b/main.go index 7faf891..4d94adb 100644 --- a/main.go +++ b/main.go @@ -7,9 +7,9 @@ import ( "prompts-core/controller" "syscall" - "gitea.com/red-future/common/http" - "gitea.com/red-future/common/jaeger" - _ "gitea.com/red-future/common/swagger" + "gitea.redpowerfuture.com/red-future/common/http" + "gitea.redpowerfuture.com/red-future/common/jaeger" + _ "gitea.redpowerfuture.com/red-future/common/swagger" _ "github.com/gogf/gf/contrib/drivers/pgsql/v2" _ "github.com/gogf/gf/contrib/nosql/redis/v2" "github.com/gogf/gf/v2/frame/g" diff --git a/model/entity/prompts_compose_session.go b/model/entity/prompts_compose_session.go index ac3f3aa..057f356 100644 --- a/model/entity/prompts_compose_session.go +++ b/model/entity/prompts_compose_session.go @@ -1,6 +1,6 @@ package entity -import "gitea.com/red-future/common/beans" +import "gitea.redpowerfuture.com/red-future/common/beans" type ComposeSession struct { beans.SQLBaseDO `orm:",inline"` diff --git a/model/entity/prompts_compose_task.go b/model/entity/prompts_compose_task.go index 90ccce7..8bbf19c 100644 --- a/model/entity/prompts_compose_task.go +++ b/model/entity/prompts_compose_task.go @@ -1,6 +1,6 @@ package entity -import "gitea.com/red-future/common/beans" +import "gitea.redpowerfuture.com/red-future/common/beans" type ComposeTask struct { beans.SQLBaseDO `orm:",inline"` diff --git a/model/entity/prompts_provider_protocol.go b/model/entity/prompts_provider_protocol.go index 865f715..542533c 100644 --- a/model/entity/prompts_provider_protocol.go +++ b/model/entity/prompts_provider_protocol.go @@ -1,6 +1,6 @@ package entity -import "gitea.com/red-future/common/beans" +import "gitea.redpowerfuture.com/red-future/common/beans" // ProviderProtocol 模型协议映射配置 type ProviderProtocol struct { diff --git a/service/gateway/gateway_http_service.go b/service/gateway/gateway_http_service.go index 0a78b5a..9e07855 100644 --- a/service/gateway/gateway_http_service.go +++ b/service/gateway/gateway_http_service.go @@ -8,8 +8,8 @@ import ( "prompts-core/model/entity" "strings" - "gitea.com/red-future/common/beans" - commonHttp "gitea.com/red-future/common/http" + "gitea.redpowerfuture.com/red-future/common/beans" + commonHttp "gitea.redpowerfuture.com/red-future/common/http" "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gtime" diff --git a/service/prompt/prompt_build_service.go b/service/prompt/prompt_build_service.go index 2180784..f84dfd4 100644 --- a/service/prompt/prompt_build_service.go +++ b/service/prompt/prompt_build_service.go @@ -11,7 +11,7 @@ import ( "prompts-core/model/dto" "prompts-core/model/entity" - "gitea.com/red-future/common/utils" + "gitea.redpowerfuture.com/red-future/common/utils" "github.com/gogf/gf/v2/encoding/gjson" ) diff --git a/service/prompt/prompt_compose_service.go b/service/prompt/prompt_compose_service.go index 402f8d1..3bd8d5e 100644 --- a/service/prompt/prompt_compose_service.go +++ b/service/prompt/prompt_compose_service.go @@ -13,8 +13,8 @@ import ( "prompts-core/model/entity" "prompts-core/service/gateway" - "gitea.com/red-future/common/beans" - "gitea.com/red-future/common/utils" + "gitea.redpowerfuture.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/utils" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/service/session/prompt_session_service.go b/service/session/prompt_session_service.go index 3d44239..18c3f8f 100644 --- a/service/session/prompt_session_service.go +++ b/service/session/prompt_session_service.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "gitea.com/red-future/common/beans" - "gitea.com/red-future/common/utils" + "gitea.redpowerfuture.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/utils" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/util/gconv"