OpenCode Deployer commited on
Commit
5387074
·
1 Parent(s): 43f9787

feat: 添加 Docker 多语言环境配置

Browse files

- 添加 Dockerfile 支持 Ubuntu + Node.js 22.x + Python 3.12
- 添加 FastAPI 应用配置,运行在 7860 端口
- 添加 requirements.txt 管理 Python 依赖
- 更新 README.md 说明项目配置和 API 端点
- 添加 .gitignore 支持多开发环境

Files changed (5) hide show
  1. .gitignore +358 -0
  2. Dockerfile +52 -0
  3. README copy.md +9 -0
  4. README.md +36 -3
  5. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1,358 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 操作系统生成的文件
2
+ # ==================
3
+
4
+ # macOS
5
+ .DS_Store
6
+ .DS_Store?
7
+ ._*
8
+ .Spotlight-V100
9
+ .Trashes
10
+ ehthumbs.db
11
+ Thumbs.db
12
+ Icon?
13
+
14
+ # Windows
15
+ *.cab
16
+ *.msi
17
+ *.msix
18
+ *.msm
19
+ *.msp
20
+ *.lnk
21
+
22
+ # Linux
23
+ *~
24
+
25
+ # 编辑器和 IDE
26
+ # ============
27
+
28
+ # Visual Studio Code
29
+ .vscode/
30
+ !.vscode/settings.json
31
+ !.vscode/tasks.json
32
+ !.vscode/launch.json
33
+ !.vscode/extensions.json
34
+
35
+ # JetBrains IDEs
36
+ .idea/
37
+ *.iws
38
+ *.iml
39
+ *.ipr
40
+ out/
41
+
42
+ # Vim
43
+ *.swp
44
+ *.swo
45
+ *~
46
+
47
+ # Emacs
48
+ *~
49
+ \#*\#
50
+ /.emacs.desktop
51
+ /.emacs.desktop.lock
52
+ *.elc
53
+ auto-save-list
54
+ tramp
55
+ .\#*
56
+
57
+ # Sublime Text
58
+ *.sublime-project
59
+ *.sublime-workspace
60
+
61
+ # Node.js
62
+ # ======
63
+
64
+ # 依赖目录
65
+ node_modules/
66
+ npm-debug.log*
67
+ yarn-debug.log*
68
+ yarn-error.log*
69
+ lerna-debug.log*
70
+
71
+ # 运行时数据
72
+ pids
73
+ *.pid
74
+ *.seed
75
+ *.pid.lock
76
+
77
+ # 覆盖率目录
78
+ lib-cov
79
+ coverage/
80
+ *.lcov
81
+ .nyc_output
82
+
83
+ # 构建输出
84
+ dist/
85
+ build/
86
+ .next/
87
+
88
+ # 缓存
89
+ .cache/
90
+ .parcel-cache/
91
+
92
+ # 环境变量文件
93
+ .env
94
+ .env.local
95
+ .env.development.local
96
+ .env.test.local
97
+ .env.production.local
98
+
99
+ # 日志文件
100
+ logs
101
+ *.log
102
+
103
+ # Python
104
+ # ======
105
+
106
+ # 字节码文件
107
+ __pycache__/
108
+ *.py[cod]
109
+ *$py.class
110
+
111
+ # 分发 / 打包
112
+ .Python
113
+ build/
114
+ develop-eggs/
115
+ dist/
116
+ downloads/
117
+ eggs/
118
+ .eggs/
119
+ lib/
120
+ lib64/
121
+ parts/
122
+ sdist/
123
+ var/
124
+ wheels/
125
+ share/python-wheels/
126
+ *.egg-info/
127
+ .installed.cfg
128
+ *.egg
129
+ MANIFEST
130
+
131
+ # PyInstaller
132
+ *.manifest
133
+ *.spec
134
+
135
+ # 单元测试
136
+ htmlcov/
137
+ .tox/
138
+ .nox/
139
+ .coverage
140
+ .coverage.*
141
+ .cache
142
+ nosetests.xml
143
+ coverage.xml
144
+ *.cover
145
+ *.py,cover
146
+ .hypothesis/
147
+ .pytest_cache/
148
+ cover/
149
+
150
+ # Jupyter Notebook
151
+ .ipynb_checkpoints
152
+
153
+ # 环境变量
154
+ .env
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # mypy
163
+ .mypy_cache/
164
+ .dmypy.json
165
+ dmypy.json
166
+
167
+ # Pyre type checker
168
+ .pyre/
169
+
170
+ # 前端相关
171
+ # ========
172
+
173
+ # Bower
174
+ bower_components
175
+
176
+ # Sass
177
+ .sass-cache/
178
+
179
+ # LiveReload
180
+ .node_modules
181
+
182
+ # Grunt intermediate storage
183
+ .grunt
184
+
185
+ # ESLint
186
+ .eslintcache
187
+
188
+ # Stylelint
189
+ .stylelintcache
190
+
191
+ # 构建工具
192
+ # ========
193
+
194
+ # Webpack
195
+ .webpack/
196
+
197
+ # Rollup
198
+ .rollup.cache/
199
+
200
+ # Snowpack
201
+ .snowpack/
202
+
203
+ # Vite
204
+ .vite/
205
+
206
+ # 数据库
207
+ # =====
208
+
209
+ # SQLite
210
+ *.db
211
+ *.sqlite
212
+ *.sqlite3
213
+
214
+ # Redis
215
+ *.rdb
216
+
217
+ # 临时文件
218
+ # ========
219
+
220
+ # 临时文件
221
+ *.tmp
222
+ *.temp
223
+
224
+ # 压缩文件
225
+ *.7z
226
+ *.dmg
227
+ *.gz
228
+ *.iso
229
+ *.jar
230
+ *.rar
231
+ *.tar
232
+ *.zip
233
+
234
+ # 其他
235
+ # ====
236
+
237
+ # 配置文件(根据需要启用)
238
+ # config.ini
239
+ # config.json
240
+
241
+ # 备份文件
242
+ *.bak
243
+ *.backup
244
+
245
+ # 本地开发文件
246
+ local/
247
+ dev/
248
+
249
+ # 文档构建
250
+ docs/_build/
251
+ site/
252
+
253
+ # 备份和归档
254
+ *.tar.gz
255
+ *.zip
256
+ *.rar
257
+
258
+ # 性能分析
259
+ *.prof
260
+
261
+ # 调试日志
262
+ debug.log
263
+ error.log
264
+
265
+ # PM2
266
+ .pm2
267
+
268
+ # Forever
269
+ *.forever
270
+
271
+ # 本地配置
272
+ config.local.js
273
+ config.local.json
274
+
275
+ # 上传目录
276
+ uploads/
277
+ static/uploads/
278
+
279
+ # 运行时
280
+ *.pid
281
+ *.seed
282
+ *.pid.lock
283
+
284
+ # 可选:npm 调试日志
285
+ npm-debug.log*
286
+ yarn-debug.log*
287
+ yarn-error.log*
288
+
289
+ # 可选:Grunt 中间存储
290
+ .grunt
291
+
292
+ # 可选:Bower 依赖目录
293
+ bower_components
294
+
295
+ # 可选:node-waf 配置
296
+ .lock-wscript
297
+
298
+ # 可选:编译的二进制插件
299
+ build/Release
300
+
301
+ # 可选:生成的文档
302
+ docs/_output
303
+
304
+ # 可选:依赖目录
305
+ jspm_packages/
306
+
307
+ # 可选:TypeScript v1 声明文件
308
+ typings/
309
+
310
+ # 可选:可选的 npm 缓存目录
311
+ .npm
312
+
313
+ # 可选:可选的 eslint 缓存
314
+ .eslintcache
315
+
316
+ # 可选:Microbundle 缓存
317
+ .rpt2_cache/
318
+ .rts2_cache_cjs/
319
+ .rts2_cache_es/
320
+ .rts2_cache_umd/
321
+
322
+ # 可选:可选的 REPL 历史
323
+ .node_repl_history
324
+
325
+ # 可选:输出的 parcel-bundler 缓存
326
+ .cache
327
+ .parcel-cache
328
+
329
+ # 可选:Next.js 构建输出
330
+ .next
331
+ out
332
+
333
+ # 可选:Nuxt.js 构建 / 生成输出
334
+ .nuxt
335
+ dist
336
+
337
+ # 可选:Gatsby 文件
338
+ .cache/
339
+ public
340
+
341
+ # 可选:Storybook 构建输出
342
+ .out
343
+ .storybook-out
344
+ storybook-static
345
+
346
+ # 可选:临时文件夹
347
+ tmp/
348
+ temp/
349
+
350
+ # 可选:编辑器目录和文件
351
+ .vscode/*
352
+ !.vscode/extensions.json
353
+ .idea
354
+ *.suo
355
+ *.ntvs*
356
+ *.njsproj
357
+ *.sln
358
+ *.sw?
Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV NODE_VERSION=22.x
6
+
7
+ WORKDIR /app
8
+
9
+ RUN apt-get update && apt-get install -y \
10
+ curl \
11
+ wget \
12
+ gnupg \
13
+ ca-certificates \
14
+ build-essential \
15
+ python3.12 \
16
+ python3.12-pip \
17
+ python3.12-venv \
18
+ python3.12-dev \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
22
+ && apt-get install -y nodejs \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ RUN node --version && npm --version
26
+
27
+ RUN python3.12 -m venv /opt/venv
28
+
29
+ RUN /opt/venv/bin/pip install --upgrade pip
30
+
31
+ ENV PATH="/opt/venv/bin:$PATH"
32
+
33
+ COPY requirements.txt .
34
+ RUN pip install -r requirements.txt
35
+
36
+ COPY <<EOF /app/main.py
37
+ from fastapi import FastAPI
38
+
39
+ app = FastAPI(title="FastAPI 服务", version="1.0.0")
40
+
41
+ @app.get("/")
42
+ async def root():
43
+ return {"message": "Hello World"}
44
+
45
+ @app.get("/health")
46
+ async def health_check():
47
+ return {"status": "healthy"}
48
+ EOF
49
+
50
+ EXPOSE 7860
51
+
52
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
README copy.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Fastoc
3
+ emoji: 🚀
4
+ colorFrom: pink
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: true
8
+ short_description: FastAPI + Node.js + Python 多语言开发环境
9
+ ---
README.md CHANGED
@@ -4,8 +4,41 @@ emoji: 🚀
4
  colorFrom: pink
5
  colorTo: purple
6
  sdk: docker
7
- pinned: false
8
- short_description: Fastapi + Opencode
9
  ---
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  colorFrom: pink
5
  colorTo: purple
6
  sdk: docker
7
+ pinned: true
8
+ short_description: FastAPI + Node.js + Python 多语言开发环境
9
  ---
10
 
11
+ # FastOC
12
+
13
+ 基于 Docker 的多语言开发环境,支持:
14
+
15
+ - **Node.js** 22.x LTS
16
+ - **Python** 3.12.x
17
+ - **FastAPI** Web 框架
18
+ - 运行在端口 **7860**
19
+
20
+ ## 技术栈
21
+
22
+ - Ubuntu 22.04 LTS
23
+ - Node.js 22.x LTS
24
+ - Python 3.12.x
25
+ - FastAPI + Uvicorn
26
+
27
+ ## API 端点
28
+
29
+ - `GET /` - 返回 Hello World
30
+ - `GET /health` - 健康检查
31
+
32
+ ## 开发环境
33
+
34
+ 这个 Space 提供了一个完整的多语言开发环境,可以用于:
35
+ - FastAPI 应用开发
36
+ - Node.js 应用开发
37
+ - Python 脚本执行
38
+ - 跨语言项目集成
39
+
40
+ ## 配置文件
41
+
42
+ - `Dockerfile` - 容器配置
43
+ - `main.py` - FastAPI 应用入口
44
+ - `requirements.txt` - Python 依赖(如果需要)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn[standard]