File size: 4,290 Bytes
ebac27c
73b316c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ebac27c
 
 
0676b38
 
 
 
 
 
 
ebac27c
73b316c
 
 
 
 
 
 
0676b38
 
 
05f7aac
ebac27c
73b316c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05f7aac
73b316c
 
 
 
 
 
 
 
 
c01d7bc
73b316c
 
 
 
 
ff05f84
 
 
0676b38
 
 
 
 
 
 
ff05f84
73b316c
 
 
 
 
 
 
0676b38
 
 
05f7aac
ff05f84
73b316c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05f7aac
73b316c
 
 
 
 
 
 
 
 
c01d7bc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Build and Publish Image

on:
  push:
    branches:
      - "main"
  pull_request:
    branches:
      - "*"
    paths:
      - "Dockerfile.local"
      - "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.local
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          platforms: linux/amd64,linux/arm64
          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.local
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          platforms: linux/amd64,linux/arm64
          build-args: |
            INCLUDE_DB=false