|
| 1 | +name: Deploy to k8s |
| 2 | +on: |
| 3 | + # run this workflow manually from the Actions tab |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-and-publish-huggingchat-image: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout |
| 11 | + uses: actions/checkout@v4 |
| 12 | + |
| 13 | + - name: Tailscale |
| 14 | + uses: huggingface/tailscale-action@main |
| 15 | + with: |
| 16 | + authkey: ${{ secrets.TAILSCALE_AUTHKEY }} |
| 17 | + |
| 18 | + - name: Extract package version |
| 19 | + id: package-version |
| 20 | + run: | |
| 21 | + VERSION=$(jq -r .version package.json) |
| 22 | + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT |
| 23 | + MAJOR=$(echo $VERSION | cut -d '.' -f1) |
| 24 | + echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT |
| 25 | + MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2) |
| 26 | + echo "MINOR=$MINOR" >> $GITHUB_OUTPUT |
| 27 | +
|
| 28 | + - name: Docker metadata |
| 29 | + id: meta |
| 30 | + uses: docker/metadata-action@v5 |
| 31 | + with: |
| 32 | + images: | |
| 33 | + ghcr.io/huggingface/chat-ui |
| 34 | + tags: | |
| 35 | + type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}} |
| 36 | + type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}} |
| 37 | + type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}} |
| 38 | + type=raw,value=latest,enable={{is_default_branch}} |
| 39 | + type=sha,enable={{is_default_branch}} |
| 40 | +
|
| 41 | + - name: Set up QEMU |
| 42 | + uses: docker/setup-qemu-action@v3 |
| 43 | + |
| 44 | + - name: Set up Docker Buildx |
| 45 | + uses: docker/setup-buildx-action@v3 |
| 46 | + |
| 47 | + - name: Login to Registry |
| 48 | + uses: docker/login-action@v2 |
| 49 | + with: |
| 50 | + registry: registry.internal.huggingface.tech |
| 51 | + username: ${{ secrets.DOCKER_INTERNAL_USERNAME }} |
| 52 | + password: ${{ secrets.DOCKER_INTERNAL_PASSWORD }} |
| 53 | + |
| 54 | + - name: Build and Publish Docker Image without DB |
| 55 | + uses: docker/build-push-action@v5 |
| 56 | + with: |
| 57 | + context: . |
| 58 | + file: Dockerfile |
| 59 | + push: ${{ github.event_name != 'pull_request' }} |
| 60 | + tags: ${{ steps.meta.outputs.tags }} |
| 61 | + labels: ${{ steps.meta.outputs.labels }} |
| 62 | + platforms: linux/amd64 |
| 63 | + cache-to: type=gha,mode=max,scope=amd64 |
| 64 | + cache-from: type=gha,scope=amd64 |
| 65 | + provenance: false |
| 66 | + build-args: | |
| 67 | + INCLUDE_DB=false |
| 68 | + APP_BASE=/chat |
| 69 | + PUBLIC_APP_COLOR=yellow |
0 commit comments