ljx77qaq commited on
Commit
aa01f14
·
verified ·
1 Parent(s): 0a3b827

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-slim AS frontend-builder
2
+
3
+ WORKDIR /app/frontend
4
+ COPY frontend/package.json frontend/package-lock.json* ./
5
+ RUN npm install
6
+ COPY frontend/ ./
7
+ RUN npm run build
8
+
9
+ # ---- Backend ----
10
+ FROM python:3.11-slim
11
+
12
+ WORKDIR /app
13
+
14
+ # 安装Python依赖
15
+ COPY backend/requirements.txt .
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # 复制后端代码
19
+ COPY backend/ .
20
+
21
+ # 复制前端构建产物
22
+ COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
23
+
24
+ # HF Spaces 使用 7860 端口
25
+ EXPOSE 7860
26
+
27
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]