diff --git a/Dockerfile b/Dockerfile index a0af6f8..3374140 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,24 @@ -FROM golang:1.26.0 AS builder +# 阶段1: 构建 +FROM golang:alpine AS builder -RUN go env -w GO111MODULE=on -RUN go env -w GOPROXY=https://goproxy.cn,direct +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 WORKDIR /build -COPY go.mod go.sum ./ - -COPY common ./common - -RUN sed -i 's|replace gitea.com/red-future/common => ../common|replace gitea.com/red-future/common => ./common|' go.mod - -RUN go mod download && go mod verify - COPY . . -RUN go mod tidy +RUN go mod download && go mod tidy -RUN CGO_ENABLED=0 GOOS=linux go build -v -o report-engine . +RUN go build -ldflags="-s -w" -o main ./main.go -FROM alpine:latest -ENV TIME_ZONE=Asia/Seoul -RUN apk add --no-cache tzdata ca-certificates && \ - ln -sf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime +EXPOSE 3013 -WORKDIR /app - -COPY --from=builder /build/report-engine . -COPY config.yml . - -RUN mkdir -p resource/log/server - -EXPOSE 3001 - -CMD ["./report-engine"] +CMD ["./main"] diff --git a/config.yml b/config.yml index 4277f2a..131a189 100644 --- a/config.yml +++ b/config.yml @@ -1,5 +1,5 @@ server: - address : ":3002" + address : ":3013" name: "data-engine" workerId: 1 logPath: "resource/log/server" diff --git a/controller/dict/api_datasource_platform_controller.go b/controller/dict/api_datasource_platform_controller.go index faeda7c..4a19869 100644 --- a/controller/dict/api_datasource_platform_controller.go +++ b/controller/dict/api_datasource_platform_controller.go @@ -5,7 +5,7 @@ import ( dto "dataengine/model/dto/dict" service "dataengine/service/dict" - "gitea.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/beans" ) type datasourcePlatformController struct{} diff --git a/controller/dict/api_interface_controller.go b/controller/dict/api_interface_controller.go index 77deac2..9853d4b 100644 --- a/controller/dict/api_interface_controller.go +++ b/controller/dict/api_interface_controller.go @@ -5,7 +5,7 @@ import ( dto "dataengine/model/dto/dict" service "dataengine/service/dict" - "gitea.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/beans" ) type apiInterfaceController struct{} diff --git a/dao/copydata/sync_task_log_dao.go b/dao/copydata/sync_task_log_dao.go index 0beb92a..40fed64 100644 --- a/dao/copydata/sync_task_log_dao.go +++ b/dao/copydata/sync_task_log_dao.go @@ -7,7 +7,7 @@ import ( entity "dataengine/model/entity/copydata" "time" - "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/util/gconv" "github.com/sirupsen/logrus" diff --git a/dao/dict/api_datasource_platform_dao.go b/dao/dict/api_datasource_platform_dao.go index 08c29e6..d14af0c 100644 --- a/dao/dict/api_datasource_platform_dao.go +++ b/dao/dict/api_datasource_platform_dao.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - "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/frame/g" "github.com/gogf/gf/v2/util/gconv" diff --git a/dao/dict/api_interface_dao.go b/dao/dict/api_interface_dao.go index 05637ad..007fd7d 100644 --- a/dao/dict/api_interface_dao.go +++ b/dao/dict/api_interface_dao.go @@ -6,7 +6,7 @@ import ( dto "dataengine/model/dto/dict" entity "dataengine/model/entity/dict" - "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/frame/g" "github.com/gogf/gf/v2/util/gconv" diff --git a/go.mod b/go.mod index 3b673ec..431d7a8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module dataengine go 1.26.0 require ( - gitea.com/red-future/common v0.0.4 + gitea.redpowerfuture.com/red-future/common v0.0.23 github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.10.0 github.com/gogf/gf/contrib/nosql/redis/v2 v2.9.5 github.com/gogf/gf/v2 v2.10.0 @@ -13,7 +13,7 @@ require ( golang.org/x/sync v0.18.0 ) -replace gitea.com/red-future/common => ../common +replace gitea.redpowerfuture.com/red-future/common => ../common require ( github.com/BurntSushi/toml v1.5.0 // indirect diff --git a/go.sum b/go.sum index a410cf7..5ce18e1 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +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 71fb87a..1154b34 100644 --- a/main.go +++ b/main.go @@ -6,9 +6,9 @@ import ( syncCtrl "dataengine/controller/sync" syncSvc "dataengine/service/sync" - "gitea.com/red-future/common/http" - "gitea.com/red-future/common/jaeger" - _ "gitea.com/red-future/common/k3sconfig" + "gitea.redpowerfuture.com/red-future/common/http" + "gitea.redpowerfuture.com/red-future/common/jaeger" + _ "gitea.redpowerfuture.com/red-future/common/k3sconfig" _ "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/dto/dict/api_datasource_platform_dto.go b/model/dto/dict/api_datasource_platform_dto.go index f52a1bb..2fdcd78 100644 --- a/model/dto/dict/api_datasource_platform_dto.go +++ b/model/dto/dict/api_datasource_platform_dto.go @@ -4,7 +4,7 @@ import ( "dataengine/consts/api-feature" entity "dataengine/model/entity/dict" - "gitea.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/beans" "github.com/gogf/gf/v2/frame/g" ) diff --git a/model/dto/dict/api_interface_dto.go b/model/dto/dict/api_interface_dto.go index 80da7bf..26bfa16 100644 --- a/model/dto/dict/api_interface_dto.go +++ b/model/dto/dict/api_interface_dto.go @@ -4,7 +4,7 @@ import ( "dataengine/consts/api-feature" entity "dataengine/model/entity/dict" - "gitea.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/beans" "github.com/gogf/gf/v2/frame/g" ) diff --git a/model/entity/copydata/sync_task_log.go b/model/entity/copydata/sync_task_log.go index c9ef82b..1524f8a 100644 --- a/model/entity/copydata/sync_task_log.go +++ b/model/entity/copydata/sync_task_log.go @@ -1,6 +1,6 @@ package copydata -import "gitea.com/red-future/common/beans" +import "gitea.redpowerfuture.com/red-future/common/beans" // SyncTaskLog 同步任务日志实体 type SyncTaskLog struct { diff --git a/model/entity/dict/api_interface.go b/model/entity/dict/api_interface.go index 614cc00..e2ee1d3 100644 --- a/model/entity/dict/api_interface.go +++ b/model/entity/dict/api_interface.go @@ -3,7 +3,7 @@ package dict import ( consts "dataengine/consts/api-feature" - "gitea.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/beans" ) // ApiInterface 接口管理实体 diff --git a/scheduler/run_sync_task_log_task.go b/scheduler/run_sync_task_log_task.go index a504ee9..37eb24a 100644 --- a/scheduler/run_sync_task_log_task.go +++ b/scheduler/run_sync_task_log_task.go @@ -9,7 +9,7 @@ import ( taskDto "dataengine/model/dto/copydata" syncSvc "dataengine/service/sync" - "gitea.com/red-future/common/beans" + "gitea.redpowerfuture.com/red-future/common/beans" _ "github.com/gogf/gf/contrib/drivers/pgsql/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx"