MasterDee/chat-ui
0
1name: Build and Publish Image2 3on:4 push:5 branches:6 - "main"7 pull_request:8 branches:9 - "*"10 paths:11 - "Dockerfile"12 - "entrypoint.sh"13 workflow_dispatch:14 release:15 types: [published, edited]16 17jobs:18 build-and-publish-image-with-db:19 runs-on: ubuntu-latest20 steps:21 - name: Checkout22 uses: actions/checkout@v423 24 - name: Extract package version25 id: package-version26 run: |27 VERSION=$(jq -r .version package.json)28 echo "VERSION=$VERSION" >> $GITHUB_OUTPUT29 MAJOR=$(echo $VERSION | cut -d '.' -f1)30 echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT31 MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)32 echo "MINOR=$MINOR" >> $GITHUB_OUTPUT33 34 - name: Docker metadata35 id: meta36 uses: docker/metadata-action@v537 with:38 images: |39 ghcr.io/huggingface/chat-ui-db40 tags: |41 type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}42 type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}43 type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}44 type=raw,value=latest,enable={{is_default_branch}}45 type=sha,enable={{is_default_branch}}46 47 - name: Set up QEMU48 uses: docker/setup-qemu-action@v349 50 - name: Set up Docker Buildx51 uses: docker/setup-buildx-action@v352 53 - name: Login to GitHub Container Registry54 if: github.event_name != 'pull_request'55 uses: docker/login-action@v356 with:57 registry: ghcr.io58 username: ${{ github.repository_owner }}59 password: ${{ secrets.GITHUB_TOKEN }}60 61 - name: Build and Publish Docker Image with DB62 uses: docker/build-push-action@v563 with:64 context: .65 file: Dockerfile66 push: ${{ github.event_name != 'pull_request' }}67 tags: ${{ steps.meta.outputs.tags }}68 labels: ${{ steps.meta.outputs.labels }}69 platforms: linux/amd64,linux/arm6470 build-args: |71 INCLUDE_DB=true72 build-and-publish-image-nodb:73 runs-on: ubuntu-latest74 steps:75 - name: Checkout76 uses: actions/checkout@v477 78 - name: Extract package version79 id: package-version80 run: |81 VERSION=$(jq -r .version package.json)82 echo "VERSION=$VERSION" >> $GITHUB_OUTPUT83 MAJOR=$(echo $VERSION | cut -d '.' -f1)84 echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT85 MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)86 echo "MINOR=$MINOR" >> $GITHUB_OUTPUT87 88 - name: Docker metadata89 id: meta90 uses: docker/metadata-action@v591 with:92 images: |93 ghcr.io/huggingface/chat-ui94 tags: |95 type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}96 type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}97 type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}98 type=raw,value=latest,enable={{is_default_branch}}99 type=sha,enable={{is_default_branch}}100 101 - name: Set up QEMU102 uses: docker/setup-qemu-action@v3103 104 - name: Set up Docker Buildx105 uses: docker/setup-buildx-action@v3106 107 - name: Login to GitHub Container Registry108 if: github.event_name != 'pull_request'109 uses: docker/login-action@v3110 with:111 registry: ghcr.io112 username: ${{ github.repository_owner }}113 password: ${{ secrets.GITHUB_TOKEN }}114 115 - name: Build and Publish Docker Image without DB116 uses: docker/build-push-action@v5117 with:118 context: .119 file: Dockerfile120 push: ${{ github.event_name != 'pull_request' }}121 tags: ${{ steps.meta.outputs.tags }}122 labels: ${{ steps.meta.outputs.labels }}123 platforms: linux/amd64,linux/arm64124 build-args: |125 INCLUDE_DB=false126 