h3rsh commited on
Commit
23c9926
·
verified ·
1 Parent(s): 5fe3c59

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -0
Dockerfile ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.9 slim image for better performance
2
+ FROM python:3.9-slim
3
+
4
+ # Install system dependencies for audio processing
5
+ RUN apt-get update && apt-get install -y \
6
+ libsndfile1 \
7
+ ffmpeg \
8
+ libsndfile1-dev \
9
+ gcc \
10
+ g++ \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Create user
14
+ RUN useradd -m -u 1000 user
15
+ USER user
16
+ ENV PATH="/home/user/.local/bin:$PATH"
17
+
18
+ # Set working directory
19
+ WORKDIR /app
20
+
21
+ # Copy requirements first for better Docker layer caching
22
+ COPY --chown=user ./requirements.txt requirements.txt
23
+
24
+ # Install Python dependencies
25
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
26
+
27
+ # Copy application files
28
+ COPY --chown=user . /app
29
+
30
+ # Expose port 7860 (Hugging Face Spaces requirement)
31
+ EXPOSE 7860
32
+
33
+ # Health check
34
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
35
+ CMD curl -f http://localhost:7860/health || exit 1
36
+
37
+ # Run the application
38
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]