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
126
127
128
  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: Build and Publish Docker Image with DB
  56. uses: docker/build-push-action@v5
  57. with:
  58. context: .
  59. file: Dockerfile
  60. push: ${{ github.event_name != 'pull_request' }}
  61. tags: ${{ steps.meta.outputs.tags }}
  62. labels: ${{ steps.meta.outputs.labels }}
  63. platforms: linux/amd64,linux/arm64
  64. build-args: |
  65. INCLUDE_DB=true
  66. build-and-publish-image-nodb:
  67. runs-on: ubuntu-latest
  68. steps:
  69. - name: Checkout
  70. uses: actions/checkout@v4
  71. - name: Extract package version
  72. id: package-version
  73. run: |
  74. VERSION=$(jq -r .version package.json)
  75. echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
  76. MAJOR=$(echo $VERSION | cut -d '.' -f1)
  77. echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
  78. MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
  79. echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
  80. - name: Docker metadata
  81. id: meta
  82. uses: docker/metadata-action@v5
  83. with:
  84. images: |
  85. ghcr.io/huggingface/chat-ui
  86. tags: |
  87. type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
  88. type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
  89. type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
  90. type=raw,value=latest,enable={{is_default_branch}}
  91. type=sha,enable={{is_default_branch}}
  92. - name: Set up QEMU
  93. uses: docker/setup-qemu-action@v3
  94. - name: Set up Docker Buildx
  95. uses: docker/setup-buildx-action@v3
  96. - name: Login to GitHub Container Registry
  97. if: github.event_name != 'pull_request'
  98. uses: docker/login-action@v3
  99. with:
  100. registry: ghcr.io
  101. username: ${{ github.repository_owner }}
  102. password: ${{ secrets.GITHUB_TOKEN }}
  103. - name: Build and Publish Docker Image without DB
  104. uses: docker/build-push-action@v5
  105. with:
  106. context: .
  107. file: Dockerfile
  108. push: ${{ github.event_name != 'pull_request' }}
  109. tags: ${{ steps.meta.outputs.tags }}
  110. labels: ${{ steps.meta.outputs.labels }}
  111. platforms: linux/amd64,linux/arm64
  112. build-args: |
  113. INCLUDE_DB=false
Tip!

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

Comments

Loading...