Spaces:
Running

SignLens / Dockerfile
venmugilrajan's picture
Deploy full Python Flask + Docker backend to Hugging Face Space for live native TTS and model inference
da66501 verified
Raw History Blame Contribute Delete
1.01 kB
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860
# Install system dependencies (needed for OpenCV, pyttsx3/espeak, and audio)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgl1 \
libglib2.0-0 \
espeak \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements and install
COPY requirements.txt /app/
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir gunicorn && \
pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY . /app
# HF Spaces run as non-root user 1000
RUN useradd -m -u 1000 user && \
chown -R user:user /app
USER user
# Expose Hugging Face Space port
EXPOSE 7860
# Run gunicorn serving app.py on port 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]