focustiki commited on
Commit
4697172
Β·
verified Β·
1 Parent(s): 86d4a57

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -11
Dockerfile CHANGED
@@ -1,37 +1,45 @@
1
  # ── Hugging Face Spaces / Docker deployment ───────────────────────────────────
2
  # Port 7860 is required for HF Spaces
3
-
4
  FROM python:3.11-slim
5
-
6
  # System deps for chromadb and sentence-transformers
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
  gcc g++ libgomp1 && \
9
  rm -rf /var/lib/apt/lists/*
10
-
11
  WORKDIR /app
12
-
13
  # Install Python deps first (cached layer)
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
-
17
  # Copy all flat-uploaded files
18
  COPY . .
19
-
20
  # Reorganise flat upload into the directory structure the app expects:
21
  # static/ β†’ index.html, manifest.json, sw.js
22
  # knowledge/ β†’ data_engineering_patterns.pdf
23
  RUN mkdir -p static knowledge && \
24
  mv index.html manifest.json sw.js static/ 2>/dev/null || true && \
25
  mv data_engineering_patterns.pdf knowledge/ 2>/dev/null || true
26
-
27
  # HF Spaces runs as non-root
28
  RUN useradd -m -u 1000 user
29
  USER user
30
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
31
-
 
 
 
 
 
 
 
 
32
  EXPOSE 7860
33
-
34
  # PORT env var is set automatically by HF Spaces to 7860
35
  ENV PORT=7860
36
-
37
- CMD ["python", "app.py"]
 
1
  # ── Hugging Face Spaces / Docker deployment ───────────────────────────────────
2
  # Port 7860 is required for HF Spaces
3
+
4
  FROM python:3.11-slim
5
+
6
  # System deps for chromadb and sentence-transformers
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
  gcc g++ libgomp1 && \
9
  rm -rf /var/lib/apt/lists/*
10
+
11
  WORKDIR /app
12
+
13
  # Install Python deps first (cached layer)
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
+
17
  # Copy all flat-uploaded files
18
  COPY . .
19
+
20
  # Reorganise flat upload into the directory structure the app expects:
21
  # static/ β†’ index.html, manifest.json, sw.js
22
  # knowledge/ β†’ data_engineering_patterns.pdf
23
  RUN mkdir -p static knowledge && \
24
  mv index.html manifest.json sw.js static/ 2>/dev/null || true && \
25
  mv data_engineering_patterns.pdf knowledge/ 2>/dev/null || true
26
+
27
  # HF Spaces runs as non-root
28
  RUN useradd -m -u 1000 user
29
  USER user
30
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
31
+
32
+ # ── UTF-8 locale ──────────────────────────────────────────────────────────────
33
+ # PDF extractors emit Unicode structural chars (U+2028, U+00A0, etc). Without
34
+ # these env vars, Python defaults to ASCII inside a minimal slim container and
35
+ # httpx raises UnicodeEncodeError when sending them upstream to Groq.
36
+ ENV LANG=C.UTF-8 \
37
+ LC_ALL=C.UTF-8 \
38
+ PYTHONIOENCODING=utf-8
39
+
40
  EXPOSE 7860
41
+
42
  # PORT env var is set automatically by HF Spaces to 7860
43
  ENV PORT=7860
44
+
45
+ CMD ["python", "app.py"]