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