YanAdjeNole commited on
Commit
de0633e
·
verified ·
1 Parent(s): 52c1e6d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -2
Dockerfile CHANGED
@@ -1,14 +1,22 @@
 
1
  FROM node:18 AS build
2
  WORKDIR /app
3
  COPY package*.json ./
4
  RUN npm install
5
  COPY . .
6
- RUN npm run build
7
 
 
8
  FROM python:3.10
9
  WORKDIR /app
 
 
10
  COPY --from=build /app/dist ./dist
 
 
11
  COPY server.py ./
12
- RUN pip install fastapi uvicorn huggingface_hub
 
 
13
  ENV PORT=7860
14
  CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # --- Frontend build stage ---
2
  FROM node:18 AS build
3
  WORKDIR /app
4
  COPY package*.json ./
5
  RUN npm install
6
  COPY . .
7
+ RUN npm run build # 这里会产出 /app/dist
8
 
9
+ # --- Runtime stage ---
10
  FROM python:3.10
11
  WORKDIR /app
12
+
13
+ # 复制构建产物
14
  COPY --from=build /app/dist ./dist
15
+
16
+ # 复制后端
17
  COPY server.py ./
18
+ COPY requirements.txt ./
19
+ RUN pip install -r requirements.txt || pip install fastapi uvicorn huggingface_hub python-multipart
20
+
21
  ENV PORT=7860
22
  CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]