SarahXia0405 commited on
Commit
33a55b5
·
verified ·
1 Parent(s): 6c5d46f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -3
Dockerfile CHANGED
@@ -3,8 +3,10 @@
3
  # =========================
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
10
 
@@ -13,13 +15,13 @@ RUN npm run build
13
  # =========================
14
  FROM python:3.11-slim
15
 
16
- WORKDIR /app
17
-
18
- # ✅ Dev Mode needs git for injected "git config" steps
19
  RUN apt-get update \
20
  && apt-get install -y --no-install-recommends git ca-certificates \
21
  && rm -rf /var/lib/apt/lists/*
22
 
 
 
23
  # ---- Python deps ----
24
  COPY requirements.txt /app/requirements.txt
25
  RUN pip install --no-cache-dir -r /app/requirements.txt
@@ -28,7 +30,11 @@ RUN pip install --no-cache-dir -r /app/requirements.txt
28
  COPY api/ /app/api/
29
 
30
  # ---- Copy built web assets ----
 
 
 
31
  COPY --from=web_builder /web/build /app/web/build
 
32
 
33
  ENV PORT=7860
34
  EXPOSE 7860
 
3
  # =========================
4
  FROM node:20-slim AS web_builder
5
  WORKDIR /web
6
+
7
  COPY web/package*.json ./
8
  RUN npm install
9
+
10
  COPY web/ ./
11
  RUN npm run build
12
 
 
15
  # =========================
16
  FROM python:3.11-slim
17
 
18
+ # ✅ Dev Mode needs git for "git config ..."
 
 
19
  RUN apt-get update \
20
  && apt-get install -y --no-install-recommends git ca-certificates \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ WORKDIR /app
24
+
25
  # ---- Python deps ----
26
  COPY requirements.txt /app/requirements.txt
27
  RUN pip install --no-cache-dir -r /app/requirements.txt
 
30
  COPY api/ /app/api/
31
 
32
  # ---- Copy built web assets ----
33
+ # ✅ Support CRA(build/) or Vite(dist/)
34
+ # If your build outputs /web/build, it will exist; if it outputs /web/dist, build step should be adjusted accordingly.
35
+ # We copy both when present.
36
  COPY --from=web_builder /web/build /app/web/build
37
+ COPY --from=web_builder /web/dist /app/web/dist
38
 
39
  ENV PORT=7860
40
  EXPOSE 7860