audioSentiment / Dockerfile
temp12821's picture
Add HF Spaces deployment fixes
dce0d90
raw
history blame contribute delete
910 Bytes
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy all application files
COPY . .
# Create a non-root user (Hugging Face requirement)
RUN useradd -m -u 1000 user
USER user
# Set environment variables for Hugging Face
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory to user home
WORKDIR $HOME/app
# Copy files to user directory
COPY --chown=user . $HOME/app
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Make start script executable
RUN chmod +x start.sh
# Run both Flask and Streamlit with XSRF protection disabled
CMD ["bash", "start.sh"]