1041006580 commited on
Commit
351a21e
·
1 Parent(s): af43cc9

feat(ci): 添加GitHub Actions构建Docker镜像并支持HuggingFace使用预构建镜像

Browse files
Files changed (3) hide show
  1. .github/workflows/docker-build.yml +55 -0
  2. Dockerfile.hf +10 -0
  3. README.md +1 -0
.github/workflows/docker-build.yml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Push Docker Image
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths-ignore:
8
+ - '**.md'
9
+ - '.gitignore'
10
+ workflow_dispatch:
11
+
12
+ env:
13
+ REGISTRY: ghcr.io
14
+ IMAGE_NAME: ${{ github.repository }}
15
+
16
+ jobs:
17
+ build-and-push:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: read
21
+ packages: write
22
+
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up Docker Buildx
28
+ uses: docker/setup-buildx-action@v3
29
+
30
+ - name: Log in to GitHub Container Registry
31
+ uses: docker/login-action@v3
32
+ with:
33
+ registry: ${{ env.REGISTRY }}
34
+ username: ${{ github.actor }}
35
+ password: ${{ secrets.GITHUB_TOKEN }}
36
+
37
+ - name: Extract metadata
38
+ id: meta
39
+ uses: docker/metadata-action@v5
40
+ with:
41
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42
+ tags: |
43
+ type=raw,value=latest,enable={{is_default_branch}}
44
+ type=sha,prefix={{branch}}-
45
+
46
+ - name: Build and push Docker image
47
+ uses: docker/build-push-action@v5
48
+ with:
49
+ context: .
50
+ push: true
51
+ tags: ${{ steps.meta.outputs.tags }}
52
+ labels: ${{ steps.meta.outputs.labels }}
53
+ cache-from: type=gha
54
+ cache-to: type=gha,mode=max
55
+ platforms: linux/amd64
Dockerfile.hf ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # HuggingFace Space Dockerfile
2
+ # 使用 GitHub Container Registry 的预构建镜像
3
+
4
+ FROM ghcr.io/1041006580/kiro.rs:latest
5
+
6
+ # HuggingFace Spaces 只支持端口 7860
7
+ EXPOSE 7860
8
+
9
+ # 使用原有的 entrypoint
10
+ ENTRYPOINT ["/app/entrypoint.sh"]
README.md CHANGED
@@ -4,6 +4,7 @@ emoji: 🤖
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: docker
 
7
  pinned: false
8
  ---
9
 
 
4
  colorFrom: blue
5
  colorTo: purple
6
  sdk: docker
7
+ dockerfile: Dockerfile.hf
8
  pinned: false
9
  ---
10