ldsprgrm commited on
Commit
9db256c
·
verified ·
1 Parent(s): 6ee8672

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image with Python 3.12
2
+ FROM python:3.12-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ # Added ffmpeg for video processing
9
+ RUN apt-get update && apt-get install -y \
10
+ portaudio19-dev \
11
+ libsdl-pango-dev \
12
+ libcairo2-dev \
13
+ libpango1.0-dev \
14
+ build-essential \
15
+ texlive-full \
16
+ wget \
17
+ ffmpeg \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Copy Python files
21
+ COPY requirements.txt .
22
+ COPY main.py .
23
+ COPY src/ ./src/
24
+ COPY utils/ ./utils/
25
+ COPY prompts/ ./prompts/
26
+
27
+ # Install Python dependencies
28
+ RUN pip install --no-cache-dir -r requirements.txt
29
+
30
+ # Download ONNX model if missing
31
+ RUN mkdir -p src/tts && \
32
+ [ ! -f src/tts/kokoro-v1.0.onnx ] && \
33
+ wget -O src/tts/kokoro-v1.0.onnx https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx
34
+
35
+ # Setup for Hugging Face Spaces
36
+ # Create a user with UID 1000 (standard for HF Spaces)
37
+ RUN useradd -m -u 1000 user
38
+
39
+ # Create writable directories and set permissions
40
+ RUN mkdir -p output media .nicegui src/tts && \
41
+ chown -R user:user /app
42
+
43
+ # Switch to non-root user
44
+ USER user
45
+
46
+ # Set Environment Variables
47
+ ENV PYTHONPATH=/app:$PYTHONPATH
48
+ ENV PORT=7860
49
+
50
+ # Expose the default HF Spaces port
51
+ EXPOSE 7860
52
+
53
+ # Start your Python script
54
+ CMD ["python", "main.py"]