ci: create workflow
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
name: Build Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build image on tag
|
||||||
|
runs-on: host-shell
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://gitea.com/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://gitee.com/gitea-actions/setup-buildx-action@v3 # 推荐使用 Gitee/Gitea 国内镜像
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: https://gitee.com/gitea-actions/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: registry.cn-shanghai.aliyuncs.com
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Show build context
|
||||||
|
run: |
|
||||||
|
echo "Ref: ${{ github.ref }}"
|
||||||
|
echo "Tag: ${GITHUB_REF_NAME}"
|
||||||
|
echo "Runner: $(uname -a)"
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
uses: https://gitee.com/gitea-actions/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
# 自动给镜像打上最新版标签和 Git Commit SHA 标签
|
||||||
|
tags: |
|
||||||
|
registry.cn-shanghai.aliyuncs.com/taochen/opencode-custom:latest
|
||||||
|
|
||||||
|
- name: Verify image
|
||||||
|
run: |
|
||||||
|
docker images | grep opencode-custom
|
||||||
|
docker run --rm opencode-custom:latest --version
|
||||||
Reference in New Issue
Block a user