From 3885ac3a8d6ef4d5493424765db966ed5d0186ea Mon Sep 17 00:00:00 2001 From: xinian Date: Wed, 28 Jan 2026 00:46:12 +0800 Subject: [PATCH] 1 --- .cnb.yml | 56 ++++++++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/.cnb.yml b/.cnb.yml index fdc231844..e2f6dac5c 100644 --- a/.cnb.yml +++ b/.cnb.yml @@ -41,8 +41,8 @@ main: depends_on: - sync to github - # ========== 编译Logic服务 ========== - - name: build logic + # ========== 编译Logic和Login服务 ========== + - name: build image: golang:1.23 cpus: 1 environment: @@ -52,36 +52,25 @@ main: commands: - source .build-info/.env && BUILD_VERSION="${BUILD_VERSION}" - mkdir -p build - - BIN_NAME="logic_${BUILD_VERSION}" - - go mod download -x - - go build -v -p=1 -trimpath -buildvcs=false -ldflags "-s -w -buildid= -extldflags '-static'" -o ./build/${BIN_NAME} ./logic - - chmod +x ./build/${BIN_NAME} - - ls -lh ./build/ - - file ./build/${BIN_NAME} - depends_on: - - cache go modules - - set version - - # ========== 编译Login服务 ========== - - name: build login - image: golang:1.23 - cpus: 1 - environment: - CGO_ENABLED: 0 - GO111MODULE: on - GOSUMDB: off - commands: - - source .build-info/.env && BUILD_VERSION="${BUILD_VERSION}" - - cd login - - mkdir -p build - - BIN_NAME="login_${BUILD_VERSION}" - - go mod download -x - - go build -v -p=1 -trimpath -buildvcs=false -ldflags "-s -w -buildid= -extldflags '-static'" -o ./build/${BIN_NAME} . - - chmod +x ./build/${BIN_NAME} - - ls -lh ./build/ - - mv ./build/${BIN_NAME} ../build/ - - cd .. - - ls -lh ./build/ + - | + # 编译Logic服务 + BIN_NAME="logic_${BUILD_VERSION}" + go mod download -x + go build -v -p=1 -trimpath -buildvcs=false -ldflags "-s -w -buildid= -extldflags '-static'" -o ./build/${BIN_NAME} ./logic + chmod +x ./build/${BIN_NAME} + ls -lh ./build/${BIN_NAME} + file ./build/${BIN_NAME} + - | + # 编译Login服务 + cd login + BIN_NAME="login_${BUILD_VERSION}" + go mod download -x + go build -v -p=1 -trimpath -buildvcs=false -ldflags "-s -w -buildid= -extldflags '-static'" -o ./build/${BIN_NAME} . + chmod +x ./build/${BIN_NAME} + ls -lh ./build/${BIN_NAME} + mv ./build/${BIN_NAME} ../build/ + cd .. + ls -lh ./build/ depends_on: - cache go modules - set version @@ -97,8 +86,7 @@ main: - /root/.cache/go-build cache_key: '{{ .Repo.Name }}-{{ .Commit.Branch }}-{{ checksum "go.mod" }}-{{ checksum "login/go.mod" }}' depends_on: - - build logic - - build login + - build # ========== SCP推送Login和Logic到指定服务器 ========== - name: deploy to login server