From 556fab33360ed31143e67154b624a33bc308483b Mon Sep 17 00:00:00 2001 From: xiaohei <3440556848@qq.com> Date: Sat, 15 Feb 2025 11:51:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=8E=A8=E9=80=81=E5=88=B0?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/docker-build.yml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index 4e9ae77..2527fcf 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -1,4 +1,5 @@ name: Docker Build + on: push: branches: @@ -7,13 +8,38 @@ on: branches: - main +env: + REGISTRY_USER: admin + REGISTRY_PASSWORD: 6nkTT9Th5z6gR?ro + IMAGE_REGISTRY: hub.docker.xiaohei.one + IMAGE_TAGS: v1 ${{ github.sha }} + jobs: build: - name: Build Docker Image + name: Build and push docker image runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v4 - name: Build Docker Image - run: docker build -t my-app:test . \ No newline at end of file + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + image: test_devops + tags: ${{ env.IMAGE_TAGS }} + registry: ${{ env.IMAGE_REGISTRY }} + + - name: login to registry + uses: redhat-actions/podman-login@v1 + with: + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + + - name: push to registry + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ env.IMAGE_REGISTRY }} \ No newline at end of file