File size: 1,150 Bytes
1ba09d2
 
9ac2357
1ba09d2
 
 
 
 
 
 
 
 
095c1d3
1ba09d2
a371aa9
095c1d3
 
1ba09d2
915373c
 
 
095c1d3
c9b0098
1ba09d2
 
 
 
 
d381318
1ba09d2
 
c74318a
1ba09d2
 
 
 
8707a34
1ba09d2
 
c9b0098
1ba09d2
 
 
c9b0098
1ba09d2
 
5739f77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Production Dockerfile for Public Speaking Coach API
# Optimized for Hugging Face Spaces or any cloud deployment
FROM python:3.11-slim

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

# Install system dependencies
RUN apt-get update && apt-get install -y \
    ffmpeg \
    libsndfile1 \
    git \
    && rm -rf /var/lib/apt/lists/*

# Set working directory

ENV OMP_NUM_THREADS=1

WORKDIR /app

# Copy requirements first (for better caching)
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install uvicorn

# Copy application code
COPY kid_coach_pipeline.py .
COPY main.py .

# Create directory for temporary files
RUN mkdir -p /tmp/uploads

# Expose port
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD python -c "import requests; requests.get('http://localhost:7860/health')"

# Run the application
# Use port 7860 for Hugging Face Spaces compatibility
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]