diff --git a/.gitea/workflows/docker_build.yml b/.gitea/workflows/docker_build.yml new file mode 100644 index 0000000..9ecbd84 --- /dev/null +++ b/.gitea/workflows/docker_build.yml @@ -0,0 +1,44 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU (for multi-arch, optional) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + run: | + echo "${{ secrets.GITEATOKEN }}" | docker login "${{ env.REGISTRY_HOST }}" -u "${{ github.actor }}" --password-stdin + env: + REGISTRY_HOST: git.home # ← ЗАМЕНИТЕ на ваш домен или IP:порт + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY_HOST }}/${{ github.repository }} + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + type=sha,format=short,prefix= + type=ref,event=tag + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file