From 0edc7d8678cf992d15b1c3f2f8c25715f68f5af6 Mon Sep 17 00:00:00 2001 From: timerzz Date: Thu, 23 May 2024 11:19:43 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BD=BF=E7=94=A8ko=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-push.yml | 18 ++++++++---------- .ko.yaml | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 .ko.yaml diff --git a/.gitea/workflows/build-push.yml b/.gitea/workflows/build-push.yml index f44ffb2..1f09482 100644 --- a/.gitea/workflows/build-push.yml +++ b/.gitea/workflows/build-push.yml @@ -4,13 +4,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: https://gitea.timerzz.com/timerzz/checkout@v4 - - name: build - run: docker build -t ${{ vars.DOCKER_REGISTRY }}/${{ vars.IMAGE_NAME }}:1.3 -f Dockerfile . - - name: tag - run: docker tag ${{ vars.DOCKER_REGISTRY }}/${{ vars.IMAGE_NAME }}:1.3 ${{ vars.DOCKER_REGISTRY }}/${{ vars.IMAGE_NAME }}:latest - - name: push 1.3 - run: docker push ${{ vars.DOCKER_REGISTRY }}/${{ vars.IMAGE_NAME }}:1.3 - - name: push latest - run: docker push ${{ vars.DOCKER_REGISTRY }}/${{ vars.IMAGE_NAME }}:latest \ No newline at end of file + - uses: https://gitea.timerzz.com/timerzz/setup-go@v4 + with: + go-version: '1.22.x' + - uses: https://gitea.timerzz.com/timerzz/checkout@v4 + - uses: https://gitea.timerzz.com/timerzz/setup-ko@v0.6 + env: + KO_DOCKER_REPO: registry.timerzz.com:20443/kedaya/watcher + - run: ko build --bare ./main diff --git a/.ko.yaml b/.ko.yaml new file mode 100644 index 0000000..4b0fb31 --- /dev/null +++ b/.ko.yaml @@ -0,0 +1,16 @@ +defaultPlatforms: + - linux/amd64 +defaultBaseImage: alpine:latest +builds: + - id: watcher + dir: . # default is . + main: ./main + env: + - CGO_ENABLED=0 + - GOPROXY=https://goproxy.cn,direct + - GOPRIVATE=gitea.timerzz.com + - GONOSUMDB=gitea.timerzz.com + - GONOPROXY=gitea.timerzz.com + ldflags: + - -s -w + - -extldflags "-static"