This commit is contained in:
tzwang 2024-10-15 16:10:29 +08:00
commit 24c8de7251
4 changed files with 54 additions and 21 deletions

View File

@ -38,10 +38,9 @@ jobs:
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- name: Build and push
- name: Build and push multi-arch image
run: |
docker build -t ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}} .
docker push ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} --push .
- name: Set up SSH key
run: |

View File

@ -1,4 +1,4 @@
FROM golang:1.22.4-alpine3.20 AS builder
FROM --platform=$BUILDPLATFORM golang:1.22.4-alpine3.20 AS builder
WORKDIR /app
COPY . .
@ -6,10 +6,12 @@ COPY . .
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct
RUN go mod download
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o pcm-core-api
ARG TARGETOS
ARG TARGETARCH
# 使用 GOOS 和 GOARCH 环境变量来构建不同架构的二进制文件
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o pcm-core-api
FROM alpine:latest
FROM --platform=$TARGETPLATFORM alpine:latest
WORKDIR /app
#修改alpine源为上海交通大学
@ -18,7 +20,7 @@ RUN apk add --no-cache ca-certificates && update-ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=builder /app/pcm-core-api .
COPY etc/pcm.yaml .
COPY --from=builder /app/etc/pcm.yaml .
ENV TZ=Asia/Shanghai

View File

@ -135,18 +135,49 @@ type CloudInfo struct {
}
type AiInfo struct {
TaskId int64 `json:"taskId,omitempty"`
ProjectId string `json:"project_id,omitempty"`
AdapterId int64 `json:"adapterId,omitempty,optional"`
AdapterName string `json:"adapterName,omitempty,optional"`
ClusterId int64 `json:"clusterId,omitempty,optional"`
ClusterIds []int64 `json:"clusterIds,omitempty,optional"`
TaskId int64 `json:"taskId,omitempty"`
TaskName string `json:"taskName,omitempty"`
Replica int32 `json:"replica,omitempty"`
ResourceType string `json:"resourceType,omitempty"`
CpuCoreNum int32 `json:"cpuCoreNum,omitempty"`
TaskType string `json:"taskType,omitempty"`
DatasetsName string `json:"datasetsName,omitempty"`
ProjectId string `json:"project_id,omitempty"`
StrategyName string `json:"strategyName,omitempty"`
ClusterToStaticWeight map[string]int32 `json:"clusterToStaticWeight,omitempty"`
Tops float64 `json:"tops,omitempty"`
ComputeCard string `json:"computeCard,omitempty,optional"`
CodeType string `json:"codeType,omitempty,optional"`
ClusterName string `json:"clusterName,omitempty,optional"`
ModelName string `json:"ModelName,omitempty,optional"`
AlgorithmName string `json:"algorithmName,omitempty,optional"`
ImageId string `json:"imageId,omitempty"`
SpecId string `json:"specId,omitempty"`
DatasetsId string `json:"datasetsId,omitempty"`
CodeId string `json:"codeId,omitempty"`
ResourceId string `json:"resourceId,omitempty"`
AlgorithmId string `json:"algorithmId,omitempty"`
Cmd string `json:"cmd,omitempty"`
Envs []string `json:"envs,omitempty"`
Params []string `json:"params,omitempty"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
StartTime string `json:"startTime,omitempty"`
RunningTime int64 `json:"runningTime,omitempty"`
Result string `json:"result,omitempty"`
JobId string `json:"jobId,omitempty"`
Datasets string `json:"datasets,omitempty"`
AlgorithmCode string `json:"algorithmCode,omitempty"`
Image string `json:"image,omitempty"`
CreateTime string `json:"createTime,omitempty"`
ImageUrl string `json:"imageUrl,omitempty"`
Command string `json:"command,omitempty"`

View File

@ -26,7 +26,8 @@ func (l *ListNoticeLogic) ListNotice(req *clientCore.ListNoticeReq) (*clientCore
var resp clientCore.ListNoticeResp
l.svcCtx.DbEngin.Raw("select * from t_notice order by created_time desc").Scan(&notices)
//TODO 防止数据量过大限制查询记录100条
l.svcCtx.DbEngin.Raw("select * from t_notice order by created_time desc limit 100").Scan(&notices)
for _, notice := range notices {
resp.Data = append(resp.Data, notice)
}