Spaces:
Running
Running
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
| PORT=7860 \ | |
| HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && apt-get clean | |
| # Create non-root user (Hugging Face Spaces requirement) | |
| RUN useradd -m -u 1000 user | |
| # Set work directory | |
| WORKDIR /home/user/app | |
| # Copy entrypoint script first | |
| COPY --chown=user:user entrypoint.sh /home/user/app/entrypoint.sh | |
| # Make entrypoint executable | |
| RUN chmod +x /home/user/app/entrypoint.sh | |
| # Create directories that will be needed | |
| RUN mkdir -p /home/user/app/langvoice_backend/uploads \ | |
| && chown -R user:user /home/user | |
| # Switch to non-root user | |
| USER user | |
| # Expose port (Hugging Face uses 7860) | |
| EXPOSE 7860 | |
| # Run entrypoint | |
| CMD ["/home/user/app/entrypoint.sh"] | |