File size: 1,285 Bytes
5327928
 
 
 
 
 
 
 
131ec5b
 
 
0f611ce
5327928
008ef04
5327928
008ef04
5327928
 
 
 
 
 
6b154ff
 
 
5327928
 
 
 
 
 
 
 
 
 
e5f63f9
b47e7e9
5327928
99c7c90
5327928
 
 
 
 
 
99c7c90
6b154ff
99c7c90
6b154ff
008ef04
99c7c90
 
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
48
49
50
51
52
FROM python:3.10-slim

RUN apt-get update && apt-get install -y \
    libsndfile1 \
    ffmpeg \
    sox \
    curl \
    git-lfs \
    pkg-config \
    libfreetype6-dev \
    libpng-dev \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m appuser

RUN mkdir -p \
    /tmp/matplotlib \
    /tmp/fontconfig \
    /tmp/lhotse \
    /app/uploads \
    /app/processed_audio \
    /app/assets \
    /app/temp_files \
    /app/static/outputs && \
    chown -R appuser:appuser /app /tmp/matplotlib /tmp/fontconfig /tmp/lhotse

WORKDIR /app

COPY --chown=appuser:appuser . .

ENV MPLCONFIGDIR=/tmp/matplotlib \
    FONTCONFIG_PATH=/tmp/fontconfig \
    LHOTSE_CACHE_DIR=/tmp/lhotse \
    HF_HUB_ENABLE_HF_TRANSFER=1 \
    PYTHONUNBUFFERED=1 
    

# 7. Install Python dependencies as non-root user
USER appuser
RUN pip install --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt && \
    python -m spacy download en_core_web_sm && \
    pip check

# 8. Health check - MODIFIED to use the new /health endpoint
HEALTHCHECK --interval=30s --timeout=10s \
    CMD curl -f http://localhost:7860/health || exit 1


# 9. Run the application - MODIFIED to use Uvicorn for FastAPI
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]