File size: 1,020 Bytes
b8d1818
04b0af0
3a7aa5f
 
 
 
04b0af0
 
41c0043
 
04b0af0
41c0043
 
 
 
 
 
b8d1818
41c0043
 
3a7aa5f
41c0043
 
3a7aa5f
41c0043
 
3a7aa5f
41c0043
 
04b0af0
2b46808
 
04b0af0
3a7aa5f
2b46808
04b0af0
2b46808
 
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
FROM python:3.11-slim

# Install system dependencies for audio processing
RUN apt-get update && apt-get install -y --no-install-recommends \
    libsndfile1 \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user for Hugging Face Spaces compatibility
RUN useradd -m -u 1000 user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1 \
    STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
    HF_HOME=/tmp/huggingface_cache

# Set working directory
WORKDIR $HOME/app

# Copy files as non-root user
COPY --chown=user . $HOME/app

# Install Python dependencies as non-root user
RUN pip install --no-cache-dir --user -r requirements.txt

# Switch to non-root user
USER user

# Expose Streamlit default port
EXPOSE 8501

# Health check
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

# Run the app on Streamlit's default port
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]