nca-toolkit / Dockerfile
ismdrobiul489's picture
Fix status API: single worker for queue consistency, exclude tmp files from list
8586027
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.9
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
imagemagick \
fonts-liberation \
wget \
&& rm -rf /var/lib/apt/lists/*
# Fix ImageMagick policy to allow text rendering
# Use find to locate policy.xml as the path varies by version
RUN find /etc -name "policy.xml" -exec sed -i 's/none/read,write/g' {} +
# Create user for Hugging Face Spaces
RUN useradd -m -u 1000 user
# Create data directory with correct permissions
RUN mkdir -p /data && chown -R user:user /data
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
# Force reinstall of dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . /app
# Hugging Face Spaces Configuration
ENV PORT=8880
ENV DATA_DIR_PATH=/data
ENV DOCKER=true
ENV LOG_LEVEL=info
ENV WHISPER_MODEL=tiny.en
# Start the server (MUST use single worker to maintain queue state!)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8880", "--workers", "1", "--timeout-keep-alive", "3600"]