akpande2 commited on
Commit
ab5e1a7
·
verified ·
1 Parent(s): 669d6f3

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +47 -0
Dockerfile ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Production Dockerfile for Public Speaking Coach API
2
+ # Optimized for Hugging Face Spaces or any cloud deployment
3
+ FROM python:3.11-slim
4
+
5
+ # Set environment variables
6
+ ENV PYTHONUNBUFFERED=1 \
7
+ PYTHONDONTWRITEBYTECODE=1 \
8
+ PIP_NO_CACHE_DIR=1 \
9
+ PIP_DISABLE_PIP_VERSION_CHECK=1
10
+
11
+ # Install system dependencies
12
+ RUN apt-get update && apt-get install -y \
13
+ ffmpeg \
14
+ libsndfile1 \
15
+ git \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Set working directory
19
+
20
+ ENV OMP_NUM_THREADS=1
21
+
22
+ WORKDIR /app
23
+
24
+ # Copy requirements first (for better caching)
25
+ COPY requirements.txt .
26
+
27
+ # Install Python dependencies
28
+ RUN pip install --no-cache-dir -r requirements.txt
29
+ RUN pip install uvicorn
30
+
31
+ # Copy application code
32
+ COPY kid_coach_pipeline.py .
33
+ COPY main.py .
34
+
35
+ # Create directory for temporary files
36
+ RUN mkdir -p /tmp/uploads
37
+
38
+ # Expose port
39
+ EXPOSE 7860
40
+
41
+ # Health check
42
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
43
+ CMD python -c "import requests; requests.get('http://localhost:7860/health')"
44
+
45
+ # Run the application
46
+ # Use port 7860 for Hugging Face Spaces compatibility
47
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]