parent
d02d463793
commit
48866b8a58
|
@ -1,92 +0,0 @@
|
||||||
version: 2
|
|
||||||
name: dev
|
|
||||||
description: ""
|
|
||||||
global:
|
|
||||||
concurrent: 1
|
|
||||||
param:
|
|
||||||
- ref: secret_name
|
|
||||||
name: ""
|
|
||||||
value: '"jcce-aliyuncs"'
|
|
||||||
required: false
|
|
||||||
type: STRING
|
|
||||||
hidden: false
|
|
||||||
- ref: project_name
|
|
||||||
name: ""
|
|
||||||
value: '"pcm-modelarts"'
|
|
||||||
required: false
|
|
||||||
type: STRING
|
|
||||||
hidden: false
|
|
||||||
trigger:
|
|
||||||
webhook: gitlink@1.0.0
|
|
||||||
event:
|
|
||||||
- ref: create_tag
|
|
||||||
ruleset:
|
|
||||||
- param-ref: tag
|
|
||||||
operator: EQ
|
|
||||||
value: '""'
|
|
||||||
ruleset-operator: AND
|
|
||||||
workflow:
|
|
||||||
- ref: start
|
|
||||||
name: 开始
|
|
||||||
task: start
|
|
||||||
- ref: git_clone_0
|
|
||||||
name: git clone
|
|
||||||
task: git_clone@1.2.6
|
|
||||||
input:
|
|
||||||
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-modelarts.git"'
|
|
||||||
ref: '"refs/heads/master"'
|
|
||||||
commit_id: '""'
|
|
||||||
depth: 1
|
|
||||||
needs:
|
|
||||||
- start
|
|
||||||
- ref: docker_image_build_0
|
|
||||||
name: docker镜像构建
|
|
||||||
task: docker_image_build@1.6.0
|
|
||||||
input:
|
|
||||||
docker_username: ((dev.docker_user))
|
|
||||||
docker_password: ((dev.docker_password))
|
|
||||||
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-modelarts"'
|
|
||||||
image_tag: git_clone_0.commit_time
|
|
||||||
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
|
||||||
docker_build_path: git_clone_0.git_path
|
|
||||||
workspace: git_clone_0.git_path
|
|
||||||
image_clean: true
|
|
||||||
image_push: true
|
|
||||||
build_args: '""'
|
|
||||||
needs:
|
|
||||||
- shell_0
|
|
||||||
- ref: end
|
|
||||||
name: 结束
|
|
||||||
task: end
|
|
||||||
needs:
|
|
||||||
- kubectl_deploy_0
|
|
||||||
- ref: kubectl_deploy_0
|
|
||||||
name: kubectl部署资源
|
|
||||||
task: kubectl_deploy@1.1.0
|
|
||||||
input:
|
|
||||||
command: '"apply"'
|
|
||||||
resource_file_path: git_clone_0.git_path
|
|
||||||
certificate_authority_data: ((dev.k8s_cad))
|
|
||||||
server: '"https://119.45.100.73:6443"'
|
|
||||||
client_certificate_data: ((dev.k8s_ccd))
|
|
||||||
client_key_data: ((dev.k8s_ckd))
|
|
||||||
hosts: '""'
|
|
||||||
needs:
|
|
||||||
- docker_image_build_0
|
|
||||||
- ref: shell_0
|
|
||||||
name: shell
|
|
||||||
image: docker.jianmuhub.com/library/debian:buster-slim
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-modelarts"'
|
|
||||||
IMAGE_TAG: git_clone_0.commit_time
|
|
||||||
SECRET_NAME: global.secret_name
|
|
||||||
PROJECT_NAME: global.project_name
|
|
||||||
PROJECT_PATH: git_clone_0.git_path
|
|
||||||
script:
|
|
||||||
- cd ${PROJECT_PATH}
|
|
||||||
- sed -i "s#image_name#${IMAGE_NAME}:${IMAGE_TAG}#" ${PROJECT_NAME}.yaml
|
|
||||||
- sed -i "s#secret_name#${SECRET_NAME}#" ${PROJECT_NAME}.yaml
|
|
||||||
- cat ${PROJECT_NAME}.yaml
|
|
||||||
needs:
|
|
||||||
- git_clone_0
|
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
version: 2
|
||||||
|
name: 阿里云
|
||||||
|
description: ""
|
||||||
|
global:
|
||||||
|
concurrent: 1
|
||||||
|
param:
|
||||||
|
- ref: ssh_host
|
||||||
|
name: ""
|
||||||
|
value: '"47.92.39.128"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: true
|
||||||
|
- ref: ssh_user
|
||||||
|
name: ""
|
||||||
|
value: '"root"'
|
||||||
|
required: false
|
||||||
|
type: STRING
|
||||||
|
hidden: true
|
||||||
|
workflow:
|
||||||
|
- ref: start
|
||||||
|
name: 开始
|
||||||
|
task: start
|
||||||
|
- ref: end
|
||||||
|
name: 结束
|
||||||
|
task: end
|
||||||
|
needs:
|
||||||
|
- ssh_cmd_0
|
||||||
|
- ref: git_clone_0
|
||||||
|
name: git clone
|
||||||
|
task: git_clone@1.2.9
|
||||||
|
input:
|
||||||
|
remote_url: '"https://gitlink.org.cn/JointCloud/pcm-modelarts.git"'
|
||||||
|
ref: '"refs/heads/master"'
|
||||||
|
commit_id: '""'
|
||||||
|
depth: 1
|
||||||
|
needs:
|
||||||
|
- start
|
||||||
|
- ref: docker_image_build_0
|
||||||
|
name: docker镜像构建
|
||||||
|
task: docker_image_build@1.6.0
|
||||||
|
input:
|
||||||
|
docker_username: ((aly.docker_user))
|
||||||
|
docker_password: ((aly.docker_password))
|
||||||
|
image_name: '"registry.cn-hangzhou.aliyuncs.com/jcce/pcm-modelarts"'
|
||||||
|
image_tag: '"latest"'
|
||||||
|
registry_address: '"registry.cn-hangzhou.aliyuncs.com"'
|
||||||
|
docker_file: '"Dockerfile"'
|
||||||
|
docker_build_path: git_clone_0.git_path
|
||||||
|
workspace: git_clone_0.git_path
|
||||||
|
image_push: true
|
||||||
|
build_args: '""'
|
||||||
|
needs:
|
||||||
|
- git_clone_0
|
||||||
|
- ref: ssh_cmd_0
|
||||||
|
name: ssh执行命令
|
||||||
|
task: ssh_cmd@1.1.1
|
||||||
|
input:
|
||||||
|
ssh_private_key: ((aly.ssh_private_key))
|
||||||
|
ssh_ip: global.ssh_host
|
||||||
|
ssh_port: '"22"'
|
||||||
|
ssh_user: global.ssh_user
|
||||||
|
ssh_cmd: '"kubectl rollout restart deployment pcm-modelarts -n ns-admin"'
|
||||||
|
needs:
|
||||||
|
- docker_image_build_0
|
||||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -1,12 +1,15 @@
|
||||||
FROM golang:1.21.2-alpine3.18 AS builder
|
FROM registry.cn-hangzhou.aliyuncs.com/jcce-images/golang:1.22.4-alpine3.20 AS builder
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY etc/ /app/
|
|
||||||
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct
|
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o pcm-modelarts
|
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o pcm-modelarts
|
||||||
|
|
||||||
FROM alpine:3.18
|
|
||||||
|
FROM registry.cn-hangzhou.aliyuncs.com/jcce-images/alpine:3.20
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
#修改alpine源为上海交通大学
|
#修改alpine源为上海交通大学
|
||||||
|
@ -16,7 +19,7 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repos
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
COPY --from=builder /app/pcm-modelarts .
|
COPY --from=builder /app/pcm-modelarts .
|
||||||
COPY etc/pcmmodelarts.yaml .
|
COPY --from=builder /app/etc/pcmmodelarts.yaml .
|
||||||
|
|
||||||
ENV TZ=Asia/Shanghai
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue