Spaces:
Paused
Paused
| name: Build and Publish Image | |
| permissions: | |
| packages: write | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| branches: | |
| - "*" | |
| paths: | |
| - "Dockerfile" | |
| - "entrypoint.sh" | |
| workflow_dispatch: | |
| release: | |
| types: [published, edited] | |
| jobs: | |
| build-and-publish-image-with-db: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract package version | |
| id: package-version | |
| run: | | |
| VERSION=$(jq -r .version package.json) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| MAJOR=$(echo $VERSION | cut -d '.' -f1) | |
| echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT | |
| MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2) | |
| echo "MINOR=$MINOR" >> $GITHUB_OUTPUT | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/huggingface/chat-ui-db | |
| tags: | | |
| type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}} | |
| type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}} | |
| type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,enable={{is_default_branch}} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Publish Docker Image with DB | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| INCLUDE_DB=true | |
| build-and-publish-image-nodb: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract package version | |
| id: package-version | |
| run: | | |
| VERSION=$(jq -r .version package.json) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| MAJOR=$(echo $VERSION | cut -d '.' -f1) | |
| echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT | |
| MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2) | |
| echo "MINOR=$MINOR" >> $GITHUB_OUTPUT | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/huggingface/chat-ui | |
| tags: | | |
| type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}} | |
| type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}} | |
| type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,enable={{is_default_branch}} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Publish Docker Image without DB | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| INCLUDE_DB=false | |