fix ci/cd bug
This commit is contained in:
parent
0693cb6876
commit
aae87aa5da
|
@ -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-hpc.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-hpc"'
|
||||
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-hpc -n ns-admin"'
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
|
|
@ -85,3 +85,5 @@ fabric.properties
|
|||
*.iml
|
||||
out
|
||||
gen
|
||||
|
||||
/vendor
|
||||
|
|
24
Dockerfile
24
Dockerfile
|
@ -1,34 +1,28 @@
|
|||
FROM golang:1.21.1-alpine3.18 AS builder
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/jcce-images/golang:1.22.4-alpine3.20 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
LABEL stage=gobuilder
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOARCH amd64
|
||||
ENV GOPROXY https://goproxy.cn,direct
|
||||
|
||||
COPY . .
|
||||
COPY etc/ /app/
|
||||
|
||||
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct
|
||||
RUN go mod download
|
||||
RUN go build -o /app/pcm-hpc /app/main.go
|
||||
|
||||
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o pcm-hpc
|
||||
|
||||
|
||||
FROM alpine:3.16.2
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/jcce-images/alpine:3.20
|
||||
WORKDIR /app
|
||||
|
||||
#修改alpine源为上海交通大学
|
||||
#修改alpine源为上海交通大学
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.sjtug.sjtu.edu.cn/g' /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache ca-certificates && update-ca-certificates && \
|
||||
apk add --update tzdata && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
COPY --from=builder /app/pcm-hpc .
|
||||
COPY etc/hpc.yaml /app/etc/
|
||||
COPY --from=builder /app/etc/hpc.yaml ./etc/
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
EXPOSE 2001
|
||||
|
||||
ENTRYPOINT ./pcm-hpc
|
||||
CMD ["./pcm-hpc"]
|
Loading…
Reference in New Issue