diff --git a/.gitea/workflows/build-image.yaml b/.gitea/workflows/build-image.yaml new file mode 100644 index 0000000..899643f --- /dev/null +++ b/.gitea/workflows/build-image.yaml @@ -0,0 +1,53 @@ +name: BuildImage + +# 只打tag事件的包 +on: + push: + branches: + - 'main' + +jobs: + build-image: + runs-on: ubuntu-latest + container: + # 使用这个镜像,不然Docker无法打包镜像 + image: catthehacker/ubuntu:act-latest + + steps: + - name: Setup Golang + uses: actions/setup-go@v3 + with: + go-version: '>=1.21.0' + cache: false + + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Gen Tags + id: gen_tags + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: gitee.ltd/lxh/drone-kuboard + tags: | + type=ref,event=branch + type=sha,format=short + + - name: Print Tags + run: | + echo "${{ steps.gen_tags.outputs.tags }}" + echo "----------------- labels -----------------" + echo "${{ steps.meta.outputs.labels }}" + + - name: Login to Repository + uses: docker/login-action@v2 + with: + registry: gitee.ltd + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + + - name: Build image + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ steps.gen_tags.outputs.tags }} + labels: ${{ steps.gen_tags.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 93d7849..6d4462e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,14 @@ FROM golang:alpine as builder WORKDIR /builder COPY . . -ENV GO111MODULE=on -ENV GOPROXY=https://goproxy.cn,direct +#ENV GO111MODULE=on +#ENV GOPROXY=https://goproxy.cn,direct RUN go version RUN go mod download && go build -o drone-kuboard RUN ls -lh && chmod +x ./drone-kuboard -FROM repo.lxh.io/alpine:3.16.0 as runner +FROM code.hyxc1.com/open/alpine:3.16.0 as runner LABEL org.opencontainers.image.authors="lxh@cxh.cn" COPY --from=builder /builder/drone-kuboard /bin diff --git a/readme.md b/readme.md index b96255c..e758e75 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,3 @@ -### 手动打包镜像 -```shell -docker build --push -t repo.lxh.io/lxh/drone-kuboard:latest . -``` - ### 使用方式 ```yaml kind: pipeline @@ -13,7 +8,7 @@ name: BuildContainerImage steps: # 更新测试环境 - name: UpdateTesting - image: repo.lxh.io/lxh/drone-kuboard + image: gitee.ltd/lxh/drone-kuboard settings: # 执行操作 restart | update action: restart