kind: pipeline type: docker name: default trigger: event: - manual steps: - name: build image: golang:1.22 commands: - go env -w GO111MODULE=on - go env -w GOPROXY=https://goproxy.cn,direct - go mod tidy - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o main main.go - ls -la main - name: upload image: appleboy/drone-scp settings: host: 193.112.151.199 username: root password: from_secret: scp_password port: 222 source: - main # - scripts/start.sh target: /opt/dockeropt/epic-go - name: restart epic-go container image: appleboy/drone-ssh settings: host: 193.112.151.199 username: root password: from_secret: scp_password port: 222 script: - echo "=== 检查文件是否存在 ===" - ls -la /opt/dockeropt/epic-go/ - echo "=== 检查文件类型 ===" - file /opt/dockeropt/epic-go/main - echo "=== 设置执行权限 ===" - chmod +x /opt/dockeropt/epic-go/main - echo "=== 检查依赖库 ===" - ldd /opt/dockeropt/epic-go/main || echo "静态链接或依赖库检查失败" - echo "=== 重启容器 ===" - docker restart epic-go