Khedhar commited on
Commit
4454058
·
1 Parent(s): 0090b2c

fix: use pip instead of uv for reliable Docker build

Browse files
Files changed (2) hide show
  1. Dockerfile +36 -14
  2. requirements.txt +13 -13
Dockerfile CHANGED
@@ -1,33 +1,55 @@
1
- # Use Python 3.12 slim for compatibility with pyproject.toml
2
- FROM python:3.12-slim
 
 
 
 
3
 
4
- # Set working directory
 
 
5
  WORKDIR /app
6
 
7
- # Install system dependencies for audio processing and webrtcvad
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  ffmpeg \
10
  libsndfile1 \
11
  git \
12
  build-essential \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Install uv for fast Python package management
16
- RUN pip install uv
 
 
 
 
17
 
18
  # Copy all project files
19
  COPY . .
20
 
21
- # Install Python dependencies using uv sync
22
- RUN uv sync --no-dev
 
 
 
 
 
 
 
 
 
23
 
24
  # Expose HuggingFace Spaces default port
25
  EXPOSE 7860
26
 
27
- # Set environment variables
28
- ENV PYTHONUNBUFFERED=1
29
- ENV STREAMLIT_SERVER_PORT=7860
30
- ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
 
 
31
 
32
- # Run the Streamlit app using uv run
33
- CMD ["uv", "run", "streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
+ # ==============================================================================
2
+ # Pharma Voice Orders - Hugging Face Spaces Dockerfile
3
+ # ==============================================================================
4
+ # This Dockerfile is optimized for Hugging Face Spaces with Docker SDK.
5
+ # It uses standard pip for maximum compatibility.
6
+ # ==============================================================================
7
 
8
+ FROM python:3.11-slim
9
+
10
+ # Set working directory FIRST
11
  WORKDIR /app
12
 
13
+ # Install system dependencies for audio processing and compilation
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
15
  ffmpeg \
16
  libsndfile1 \
17
  git \
18
  build-essential \
19
+ && apt-get clean \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Copy requirements first for better caching
23
+ COPY requirements.txt .
24
+
25
+ # Install Python dependencies with pip
26
+ RUN pip install --no-cache-dir --upgrade pip && \
27
+ pip install --no-cache-dir -r requirements.txt
28
 
29
  # Copy all project files
30
  COPY . .
31
 
32
+ # Create non-root user for security (HF Spaces requirement)
33
+ RUN useradd -m -u 1000 user
34
+ USER user
35
+ ENV HOME=/home/user \
36
+ PATH=/home/user/.local/bin:$PATH
37
+
38
+ # Set working directory for user
39
+ WORKDIR $HOME/app
40
+
41
+ # Copy files to user directory
42
+ COPY --chown=user . $HOME/app
43
 
44
  # Expose HuggingFace Spaces default port
45
  EXPOSE 7860
46
 
47
+ # Set environment variables for Streamlit
48
+ ENV PYTHONUNBUFFERED=1 \
49
+ STREAMLIT_SERVER_PORT=7860 \
50
+ STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
51
+ STREAMLIT_SERVER_HEADLESS=true \
52
+ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
53
 
54
+ # Run the Streamlit app
55
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
requirements.txt CHANGED
@@ -1,14 +1,14 @@
1
- streamlit
2
- pandas
3
- openpyxl
4
- torch
5
- transformers
6
- librosa
7
- noisereduce
8
- soundfile
9
- rapidfuzz
10
- jiwer
11
- regex
12
- webrtcvad
13
- numpy<2.0.0
14
  huggingface_hub
 
1
+ jiwer>=4.0.0
2
+ librosa>=0.11.0
3
+ noisereduce>=3.0.3
4
+ numpy<2
5
+ openpyxl>=3.1.5
6
+ pandas>=2.3.3
7
+ rapidfuzz>=3.14.3
8
+ regex>=2024.1.15
9
+ soundfile>=0.13.1
10
+ streamlit>=1.53.0
11
+ torch>=2.9.1
12
+ transformers>=4.57.6
13
+ webrtcvad>=2.0.10
14
  huggingface_hub