tubeMate / Dockerfile
ShivamPansuriya
Add application file
74708f4
# Use Python 3.11 slim image for better performance
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies with NumPy compatibility fix
RUN pip install --no-cache-dir "numpy<2.0.0" && \
pip install --no-cache-dir -r requirements.txt
# Set environment variables for optimal performance
ENV WHISPER_MODEL=tiny
ENV MODEL_PRELOAD=true
ENV DEBUG=false
ENV PYTHONUNBUFFERED=1
# Copy application code
COPY . .
# Create non-root user for security
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8000/health')"
# Run the application with robust startup
CMD ["python", "start_robust.py"]