# DigiPal - Digital Pet Application with MCP Server # Dockerfile for HuggingFace Spaces deployment FROM python:3.11-slim # Set working directory WORKDIR /app # Create user with ID 1000 for HF Spaces compatibility RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Switch to app directory and set ownership WORKDIR $HOME/app # Install system dependencies (as root temporarily) USER root RUN apt-get update && apt-get install -y \ git \ curl \ build-essential \ libsndfile1 \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Switch back to user USER user # Copy requirements first for better caching COPY --chown=user requirements-hf.txt requirements.txt # Install Python dependencies RUN pip install --user --no-cache-dir -r requirements.txt # Copy application code COPY --chown=user . . # Create necessary directories RUN mkdir -p assets/images assets/backups logs # Set environment variables ENV PYTHONPATH=$HOME/app ENV GRADIO_SERVER_NAME=0.0.0.0 ENV GRADIO_SERVER_PORT=7860 ENV DIGIPAL_ENV=production ENV DIGIPAL_LOG_LEVEL=INFO # Expose port for Gradio EXPOSE 7860 # Run the application CMD ["python", "app.py"]