Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

build-image.yml 4.6 KB

You have to be logged in to leave a comment. Sign In
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  1. name: Build and Publish Image
  2. permissions:
  3. packages: write
  4. on:
  5. push:
  6. branches:
  7. - "main"
  8. pull_request:
  9. branches:
  10. - "*"
  11. paths:
  12. - "Dockerfile"
  13. - "entrypoint.sh"
  14. workflow_dispatch:
  15. release:
  16. types: [published, edited]
  17. jobs:
  18. build-and-publish-image-with-db:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Checkout
  22. uses: actions/checkout@v4
  23. - name: Extract package version
  24. id: package-version
  25. run: |
  26. VERSION=$(jq -r .version package.json)
  27. echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
  28. MAJOR=$(echo $VERSION | cut -d '.' -f1)
  29. echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
  30. MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
  31. echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
  32. - name: Docker metadata
  33. id: meta
  34. uses: docker/metadata-action@v5
  35. with:
  36. images: |
  37. ghcr.io/huggingface/chat-ui-db
  38. tags: |
  39. type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
  40. type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
  41. type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
  42. type=raw,value=latest,enable={{is_default_branch}}
  43. type=sha,enable={{is_default_branch}}
  44. - name: Set up QEMU
  45. uses: docker/setup-qemu-action@v3
  46. - name: Set up Docker Buildx
  47. uses: docker/setup-buildx-action@v3
  48. - name: Login to GitHub Container Registry
  49. if: github.event_name != 'pull_request'
  50. uses: docker/login-action@v3
  51. with:
  52. registry: ghcr.io
  53. username: ${{ github.repository_owner }}
  54. password: ${{ secrets.GITHUB_TOKEN }}
  55. - name: Inject slug/short variables
  56. uses: rlespinasse/github-slug-action@v4.5.0
  57. - name: Build and Publish Docker Image with DB
  58. uses: docker/build-push-action@v5
  59. with:
  60. context: .
  61. file: Dockerfile
  62. push: ${{ github.event_name != 'pull_request' }}
  63. tags: ${{ steps.meta.outputs.tags }}
  64. labels: ${{ steps.meta.outputs.labels }}
  65. platforms: linux/amd64,linux/arm64
  66. cache-from: type=gha
  67. cache-to: type=gha,mode=max
  68. build-args: |
  69. INCLUDE_DB=true
  70. PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
  71. build-and-publish-image-nodb:
  72. runs-on: ubuntu-latest
  73. steps:
  74. - name: Checkout
  75. uses: actions/checkout@v4
  76. - name: Extract package version
  77. id: package-version
  78. run: |
  79. VERSION=$(jq -r .version package.json)
  80. echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
  81. MAJOR=$(echo $VERSION | cut -d '.' -f1)
  82. echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
  83. MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
  84. echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
  85. - name: Docker metadata
  86. id: meta
  87. uses: docker/metadata-action@v5
  88. with:
  89. images: |
  90. ghcr.io/huggingface/chat-ui
  91. tags: |
  92. type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
  93. type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
  94. type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
  95. type=raw,value=latest,enable={{is_default_branch}}
  96. type=sha,enable={{is_default_branch}}
  97. - name: Set up QEMU
  98. uses: docker/setup-qemu-action@v3
  99. - name: Set up Docker Buildx
  100. uses: docker/setup-buildx-action@v3
  101. - name: Login to GitHub Container Registry
  102. if: github.event_name != 'pull_request'
  103. uses: docker/login-action@v3
  104. with:
  105. registry: ghcr.io
  106. username: ${{ github.repository_owner }}
  107. password: ${{ secrets.GITHUB_TOKEN }}
  108. - name: Inject slug/short variables
  109. uses: rlespinasse/github-slug-action@v4.5.0
  110. - name: Build and Publish Docker Image without DB
  111. uses: docker/build-push-action@v5
  112. with:
  113. context: .
  114. file: Dockerfile
  115. push: ${{ github.event_name != 'pull_request' }}
  116. tags: ${{ steps.meta.outputs.tags }}
  117. labels: ${{ steps.meta.outputs.labels }}
  118. platforms: linux/amd64,linux/arm64
  119. cache-from: type=gha
  120. cache-to: type=gha,mode=max
  121. build-args: |
  122. INCLUDE_DB=false
  123. PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...