ahanbose commited on
Commit
6d4385f
·
verified ·
1 Parent(s): 91821ab

Upload DockerFile

Browse files
Files changed (1) hide show
  1. src/DockerFile +37 -0
src/DockerFile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python image
2
+ FROM python:3.11-slim
3
+
4
+ # 1. Set environment variables
5
+ ENV PYTHONUNBUFFERED=1 \
6
+ PYTHONDONTWRITEBYTECODE=1 \
7
+ HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
+ # 2. Install system dependencies for audio and TTS
11
+ RUN apt-get update && apt-get install -y \
12
+ ffmpeg \
13
+ libsndfile1 \
14
+ git \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # 3. Create a non-root user (Hugging Face requirement for security)
18
+ RUN useradd -m -u 1000 user
19
+ USER user
20
+ WORKDIR $HOME/app
21
+
22
+ # 4. Install Python dependencies
23
+ # Copy requirements first to leverage Docker caching
24
+ COPY --chown=user requirements.txt .
25
+ RUN pip install --no-cache-dir --upgrade pip && \
26
+ pip install --no-cache-dir -r requirements.txt
27
+
28
+ # 5. Copy the source code
29
+ # This copies everything from your local 'src' folder into the container
30
+ COPY --chown=user src/ .
31
+
32
+ # 6. Expose the port Hugging Face expects
33
+ EXPOSE 7860
34
+
35
+ # 7. Start the Streamlit app
36
+ # We use 0.0.0.0 to ensure it's accessible within the container network
37
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]