name: Build & push Docker image on: push: branches: - main # Allow manual re-builds from the Actions tab workflow_dispatch: jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v6 with: context: . push: true tags: | ${{ secrets.DOCKERHUB_USERNAME }}/at-tracker:latest ${{ secrets.DOCKERHUB_USERNAME }}/at-tracker:${{ github.sha }} # Layer cache via GitHub Actions cache — speeds up repeat builds cache-from: type=gha cache-to: type=gha,mode=max