Rixhot commited on
Commit
e0e9555
Β·
verified Β·
1 Parent(s): e95ac06

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -22
Dockerfile CHANGED
@@ -1,12 +1,5 @@
1
- # ============================================================
2
- # JARVIS β€” HuggingFace Space Dockerfile
3
- # Single container: Nginx (7860) β†’ React + proxies /api β†’ uvicorn (8000)
4
- # Runs as non-root user (uid 1000) per HF Spaces requirement
5
- # ============================================================
6
-
7
  FROM python:3.11-slim
8
 
9
- # System packages
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
11
  ffmpeg \
12
  espeak-ng \
@@ -18,7 +11,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
18
  && apt-get install -y nodejs \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
- # Non-root user required by HuggingFace Spaces
22
  RUN useradd -m -u 1000 user
23
  ENV HOME=/home/user \
24
  PATH=/home/user/.local/bin:$PATH \
@@ -27,29 +19,27 @@ ENV HOME=/home/user \
27
 
28
  WORKDIR /home/user/app
29
 
30
- # ── Install Python deps (as user) ─────────────────────────
 
 
 
 
 
 
31
  COPY --chown=user backend/requirements_hf.txt ./
32
- RUN pip install --upgrade pip setuptools wheel && \
33
- pip install --user --no-cache-dir -r requirements_hf.txt
34
 
35
- # ── Build React frontend ───────────────────────────────────
36
  COPY --chown=user frontend/package.json ./frontend/
37
  RUN cd frontend && npm install --legacy-peer-deps --silent
38
 
39
  COPY --chown=user frontend/ ./frontend/
40
- RUN cd frontend && npm run build || cat npm-debug.log || true
41
 
42
- # ── Copy backend ───────────────────────────────────────────
43
  COPY --chown=user backend/ ./backend/
44
-
45
- # ── Nginx config ───────────────────────────────────────────
46
  COPY --chown=user nginx_hf.conf /home/user/nginx.conf
47
-
48
- # ── Startup script ─────────────────────────────────────────
49
  COPY --chown=user start.sh ./
50
  RUN chmod +x start.sh
51
 
52
- # ── Runtime dirs ───────────────────────────────────────────
53
  RUN mkdir -p \
54
  /home/user/app/backend/data/faiss_index \
55
  /home/user/app/backend/uploads \
@@ -58,8 +48,39 @@ RUN mkdir -p \
58
  /home/user/tmp/fastcgi
59
 
60
  USER user
61
-
62
- # HuggingFace Spaces requires port 7860
63
  EXPOSE 7860
64
-
65
  CMD ["./start.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM python:3.11-slim
2
 
 
3
  RUN apt-get update && apt-get install -y --no-install-recommends \
4
  ffmpeg \
5
  espeak-ng \
 
11
  && apt-get install -y nodejs \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
14
  RUN useradd -m -u 1000 user
15
  ENV HOME=/home/user \
16
  PATH=/home/user/.local/bin:$PATH \
 
19
 
20
  WORKDIR /home/user/app
21
 
22
+ RUN pip install --upgrade pip setuptools wheel
23
+
24
+ RUN pip install --no-cache-dir \
25
+ torch==2.2.2 \
26
+ torchvision==0.17.2 \
27
+ --index-url https://download.pytorch.org/whl/cpu
28
+
29
  COPY --chown=user backend/requirements_hf.txt ./
30
+ RUN pip install --user --no-cache-dir -r requirements_hf.txt
 
31
 
 
32
  COPY --chown=user frontend/package.json ./frontend/
33
  RUN cd frontend && npm install --legacy-peer-deps --silent
34
 
35
  COPY --chown=user frontend/ ./frontend/
36
+ RUN cd frontend && npm run build
37
 
 
38
  COPY --chown=user backend/ ./backend/
 
 
39
  COPY --chown=user nginx_hf.conf /home/user/nginx.conf
 
 
40
  COPY --chown=user start.sh ./
41
  RUN chmod +x start.sh
42
 
 
43
  RUN mkdir -p \
44
  /home/user/app/backend/data/faiss_index \
45
  /home/user/app/backend/uploads \
 
48
  /home/user/tmp/fastcgi
49
 
50
  USER user
 
 
51
  EXPOSE 7860
 
52
  CMD ["./start.sh"]
53
+ ```
54
+
55
+ ---
56
+
57
+ ## File 2 β€” Edit `backend/requirements_hf.txt`
58
+
59
+ Go to Files β†’ `backend` folder β†’ `requirements_hf.txt` β†’ pencil β†’ **select all, delete, paste this:**
60
+ ```
61
+ fastapi==0.111.0
62
+ uvicorn[standard]==0.29.0
63
+ python-multipart==0.0.9
64
+ websockets==12.0
65
+ transformers==4.40.1
66
+ accelerate==0.29.3
67
+ sentencepiece==0.2.0
68
+ protobuf==4.25.3
69
+ sentence-transformers==2.7.0
70
+ openai-whisper==20231117
71
+ Pillow==10.3.0
72
+ opencv-python-headless==4.9.0.80
73
+ faiss-cpu==1.8.0
74
+ numpy==1.26.4
75
+ sqlalchemy==2.0.29
76
+ aiosqlite==0.20.0
77
+ duckduckgo-search==5.3.0
78
+ pydantic==2.7.1
79
+ pydantic-settings==2.2.1
80
+ python-dotenv==1.0.1
81
+ httpx==0.27.0
82
+ aiofiles==23.2.1
83
+ loguru==0.7.2
84
+ tenacity==8.2.3
85
+ scipy==1.13.0
86
+ soundfile==0.12.1