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.7 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
141
142
  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:
  20. group: aws-general-8-plus
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@v4
  24. - name: Extract package version
  25. id: package-version
  26. run: |
  27. VERSION=$(jq -r .version package.json)
  28. echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
  29. MAJOR=$(echo $VERSION | cut -d '.' -f1)
  30. echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
  31. MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
  32. echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
  33. - name: Docker metadata
  34. id: meta
  35. uses: docker/metadata-action@v5
  36. with:
  37. images: |
  38. ghcr.io/huggingface/chat-ui-db
  39. tags: |
  40. type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
  41. type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
  42. type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
  43. type=raw,value=latest,enable={{is_default_branch}}
  44. type=sha,enable={{is_default_branch}}
  45. - name: Set up QEMU
  46. uses: docker/setup-qemu-action@v3
  47. - name: Set up Docker Buildx
  48. uses: docker/setup-buildx-action@v3
  49. - name: Login to GitHub Container Registry
  50. if: github.event_name != 'pull_request'
  51. uses: docker/login-action@v3
  52. with:
  53. registry: ghcr.io
  54. username: ${{ github.repository_owner }}
  55. password: ${{ secrets.GITHUB_TOKEN }}
  56. - name: Inject slug/short variables
  57. uses: rlespinasse/github-slug-action@v4.5.0
  58. - name: Build and Publish Docker Image with DB
  59. uses: docker/build-push-action@v5
  60. with:
  61. context: .
  62. file: Dockerfile
  63. push: ${{ github.event_name != 'pull_request' }}
  64. tags: ${{ steps.meta.outputs.tags }}
  65. labels: ${{ steps.meta.outputs.labels }}
  66. platforms: linux/amd64,linux/arm64
  67. cache-from: type=gha
  68. cache-to: type=gha,mode=max
  69. build-args: |
  70. INCLUDE_DB=true
  71. PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
  72. build-and-publish-image-nodb:
  73. runs-on:
  74. group: aws-general-8-plus
  75. steps:
  76. - name: Checkout
  77. uses: actions/checkout@v4
  78. - name: Extract package version
  79. id: package-version
  80. run: |
  81. VERSION=$(jq -r .version package.json)
  82. echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
  83. MAJOR=$(echo $VERSION | cut -d '.' -f1)
  84. echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
  85. MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
  86. echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
  87. - name: Docker metadata
  88. id: meta
  89. uses: docker/metadata-action@v5
  90. with:
  91. images: |
  92. ghcr.io/huggingface/chat-ui
  93. tags: |
  94. type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
  95. type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
  96. type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
  97. type=raw,value=latest,enable={{is_default_branch}}
  98. type=sha,enable={{is_default_branch}}
  99. - name: Set up QEMU
  100. uses: docker/setup-qemu-action@v3
  101. - name: Set up Docker Buildx
  102. uses: docker/setup-buildx-action@v3
  103. - name: Login to GitHub Container Registry
  104. if: github.event_name != 'pull_request'
  105. uses: docker/login-action@v3
  106. with:
  107. registry: ghcr.io
  108. username: ${{ github.repository_owner }}
  109. password: ${{ secrets.GITHUB_TOKEN }}
  110. - name: Inject slug/short variables
  111. uses: rlespinasse/github-slug-action@v4.5.0
  112. - name: Build and Publish Docker Image without DB
  113. uses: docker/build-push-action@v5
  114. with:
  115. context: .
  116. file: Dockerfile
  117. push: ${{ github.event_name != 'pull_request' }}
  118. tags: ${{ steps.meta.outputs.tags }}
  119. labels: ${{ steps.meta.outputs.labels }}
  120. platforms: linux/amd64,linux/arm64
  121. cache-from: type=gha
  122. cache-to: type=gha,mode=max
  123. build-args: |
  124. INCLUDE_DB=false
  125. 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...