diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 4dc26ab..be16bc0 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,52 +1,58 @@ -name: Build and publish on dockerhub +name: Docker Build and Publish -on: +on: + schedule: + - cron: '30 6 * * SUN' + push: + branches: [ "main" ] + paths-ignore: + - '**/README.md' + pull_request: + branches: [ "main" ] + paths-ignore: + - '**/README.md' workflow_dispatch: jobs: - build: + ## define job to build and publish docker image + build-and-push-docker-image: + name: Build Docker image amd publish to Gitea runs-on: ubuntu-latest + permissions: + contents: read + packages: write + ## This is used to complete the identity challenge + ## with sigstore/fulcio when running outside of PRs. + id-token: write + steps: - - name: Check disk usage - run: df -h - - - name: Remove unused Docker images - run: docker system prune -af - - - name: Clean up temporary files - run: sudo rm -rf /tmp/* - - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 - - - name: Login to Docker Hub + + ## https://github.com/docker/build-push-action + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + ## https://github.com/docker/login-action + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: - username: ${{ secrets.GITEA_USERNAME }} - password: ${{ secrets.GITEA_TOKEN }} + registry: git.sdgarren.com + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: | - ${{ secrets.DOCKERHUB_USERNAME }}/rocm-wyoming-whisper - # generate Docker tags based on the following events/attributes - tags: | - type=raw,value={{date 'YYYY-MM-DD-HH.mm' tz='Europe/Rome'}} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push + + ## https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push uses: docker/build-push-action@v5 with: + provenance: false context: . - file: ./Dockerfile + platforms: linux/amd64 push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - #cache-from: type=gha - #cache-to: type=gha,mode=max - + tags: | + git.sdgarren.com/scott/rocm-wyoming-whisper:latest + + - name: Image digest + run: echo ${{ steps.build-and-push.outputs.digest }} \ No newline at end of file