Merge branch 'dev' #73
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger on pushes to the main branch | |
| - dev | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write # This is crucial for pushing to GHCR | |
| strategy: | |
| matrix: | |
| version: [full, slim] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} # Use the automatically generated GITHUB_TOKEN | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set lowercase repository name | |
| id: repo_name_lower | |
| run: echo "repo_name_lower=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.merged | |
| push: true | |
| tags: ghcr.io/${{ steps.repo_name_lower.outputs.repo_name_lower }}:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}-${{ matrix.version }} | |
| build-args: | | |
| BUILD_VERSION=${{ matrix.version }} | |
| HUGGING_FACE_HUB_TOKEN_RUNTIME=${{ secrets.HUGGING_FACE_TOKEN }} | |
| secrets: | | |
| HUGGING_FACE_HUB_TOKEN=${{ secrets.HUGGING_FACE_TOKEN }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |