SarahXia0405 commited on
Commit
967f8b2
·
verified ·
1 Parent(s): 579e8b7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -3
Dockerfile CHANGED
@@ -4,24 +4,29 @@
4
  FROM node:20-slim AS web_builder
5
  WORKDIR /web
6
  COPY web/package*.json ./
7
- RUN npm ci
8
  COPY web/ ./
9
- RUN npm run build # Vite default -> /web/dist
10
 
11
  # =========================
12
  # 2) API runtime stage
13
  # =========================
14
  FROM python:3.11-slim
 
15
  WORKDIR /app
16
 
 
17
  COPY requirements.txt /app/requirements.txt
18
  RUN pip install --no-cache-dir -r /app/requirements.txt
19
 
 
20
  COPY api/ /app/api/
21
 
22
  # ---- Copy built web assets ----
23
- COPY --from=web_builder /web/dist /app/web/dist
24
 
 
25
  ENV PORT=7860
26
  EXPOSE 7860
27
  CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
4
  FROM node:20-slim AS web_builder
5
  WORKDIR /web
6
  COPY web/package*.json ./
7
+ RUN npm install
8
  COPY web/ ./
9
+ RUN npm run build # -> outputs /web/build (per your log)
10
 
11
  # =========================
12
  # 2) API runtime stage
13
  # =========================
14
  FROM python:3.11-slim
15
+
16
  WORKDIR /app
17
 
18
+ # ---- Python deps ----
19
  COPY requirements.txt /app/requirements.txt
20
  RUN pip install --no-cache-dir -r /app/requirements.txt
21
 
22
+ # ---- Copy API source ----
23
  COPY api/ /app/api/
24
 
25
  # ---- Copy built web assets ----
26
+ COPY --from=web_builder /web/build /app/web/build
27
 
28
+ # ---- Run API (serves web build too) ----
29
  ENV PORT=7860
30
  EXPOSE 7860
31
  CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]
32
+ ---