FROM python:3.9-slim # Install system dependencies including ffmpeg RUN apt-get update && \ apt-get install -y \ ffmpeg \ curl \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Create user for Hugging Face RUN useradd -m -u 1000 user # Set working directory WORKDIR /app # Copy requirements first for better caching COPY --chown=user:user requirements.txt . # Switch to user and install Python dependencies USER user ENV PATH="/home/user/.local/bin:$PATH" RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy application code COPY --chown=user:user . . # Create necessary directories RUN mkdir -p /tmp/audio_extractor # Set environment variables ENV PYTHONPATH=/app ENV TEMP_DIR=/tmp/audio_extractor ENV FFMPEG_PATH=/usr/bin/ffmpeg # Authentication and N8N Configuration ENV ENFORCE_AUTHENTICATION=true ENV ENABLE_EXTERNAL_JOB_IDS=true ENV JWT_VALIDATION_STRICT=false ENV N8N_BASE_URL=http://localhost:5678 ENV N8N_TOKEN=default-token-change-me ENV N8N_TIMEOUT=30 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:7860/api/v1/health || exit 1 # Expose port EXPOSE 7860 # Run the application CMD ["python", "main.py"]