gdtiti commited on
Commit
c272bb0
·
1 Parent(s): fab99ab

尝试推送dockerfile实现space部署

Browse files
Files changed (4) hide show
  1. .dockerignore +10 -0
  2. DEPLOY.md +51 -0
  3. Dockerfile +11 -0
  4. README.md +24 -5
.dockerignore ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git
3
+ .gitignore
4
+
5
+ # Documentation
6
+ *.md
7
+ docs/
8
+
9
+ # HF Spaces specific (already configured in README)
10
+ # No need to ignore anything else since we're using a pre-built image
DEPLOY.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Spaces 部署指南
2
+
3
+ ## 🚀 最简单的部署方式
4
+
5
+ 你的项目已经配置好使用预构建的Docker镜像 `docker.io/library/my-image-name:1763908533`
6
+
7
+ ### 部署步骤
8
+
9
+ 1. **创建 Hugging Face Space**
10
+ - 访问 [huggingface.co/spaces](https://huggingface.co/spaces)
11
+ - 点击 "Create new Space"
12
+ - 选择 "Docker" 作为 SDK
13
+ - 空间名称:例如 `ai-studio-build`
14
+
15
+ 2. **上传文件**
16
+ ```bash
17
+ # 初始化git仓库
18
+ git init
19
+ git add .
20
+ git commit -m "Initial commit - pre-built Docker image deployment"
21
+
22
+ # 添加HF远程仓库
23
+ git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
24
+ git push origin main
25
+ ```
26
+
27
+ 3. **自动部署**
28
+ - Hugging Face Spaces 会自动读取README.md中的配置
29
+ - 使用指定的Docker镜像进行部署
30
+ - 应用将在 `https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space` 可访问
31
+
32
+ ## 🔧 配置文件说明
33
+
34
+ - `README.md`: 包含Space元数据和部署配置
35
+ - `Dockerfile`: 指定使用预构建镜像和端口配置
36
+ - `.dockerignore`: 排除不必要的文件
37
+
38
+ ## 📋 部署检查清单
39
+
40
+ - [x] Docker镜像已构建:`docker.io/library/my-image-name:1763908533`
41
+ - [x] README.md配置正确(sdk: docker, app_port: 7860)
42
+ - [x] Dockerfile指向正确的预构建镜像
43
+ - [x] 端口7860已暴露(HF Spaces标准)
44
+
45
+ ## 🎯 完成后
46
+
47
+ 部署成功后,你的应用将:
48
+ - 自动从Docker Hub拉取指定镜像
49
+ - 在端口7860上运行
50
+ - 支持Web界面访问
51
+ - 具备HTTPS安全连接
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用预构建镜像的 Hugging Face Spaces 部署
2
+ # 指定使用你的预构建Docker镜像
3
+ FROM docker.io/library/my-image-name:1763908533
4
+
5
+ # 暴露HF Spaces标准端口
6
+ EXPOSE 7860
7
+
8
+ # 设置环境变量
9
+ ENV PORT=7860
10
+ ENV GRADIO_SERVER_NAME=0.0.0.0
11
+ ENV GRADIO_SERVER_PORT=7860
README.md CHANGED
@@ -1,10 +1,29 @@
1
  ---
2
- title: Yyyy
3
- emoji: 💻
4
- colorFrom: pink
5
- colorTo: red
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: YYY
3
+ emoji: 🚀
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: docker
7
  pinned: false
8
+ app_port: 7860
9
  ---
10
 
11
+ # AI Studio Build on Hugging Face Spaces
12
+
13
+ This application is deployed using a pre-built Docker image.
14
+
15
+ ## Image Details
16
+ - **Image**: docker.io/library/my-image-name:1763908533
17
+ - **Port**: 7860 (standard HF Spaces port)
18
+
19
+ ## Deployment
20
+
21
+ The Space is configured to automatically use the pre-built Docker image. No additional configuration needed.
22
+
23
+ ## Local Development
24
+
25
+ ```bash
26
+ docker run -p 7860:7860 docker.io/library/my-image-name:1763908533
27
+ ```
28
+
29
+ Access the application at http://localhost:7860