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

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

Comments

Loading...