AI_Avatar_Chat / Dockerfile
bravedims
🔧 Fix repository build issues for reliable deployment
0ebc7ca
raw
history blame
1.39 kB
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
ffmpeg \
libsndfile1 \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip and install build tools first
RUN pip install --upgrade pip setuptools wheel
# Create necessary directories
RUN mkdir -p /tmp/gradio_flagged \
/tmp/matplotlib \
/tmp/huggingface \
/tmp/huggingface/transformers \
/tmp/huggingface/datasets \
/tmp/huggingface/hub \
/app/outputs \
/app/configs \
/app/scripts \
/app/examples \
&& chmod -R 777 /tmp
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies with error handling
RUN pip install --no-cache-dir --timeout=1000 -r requirements.txt
# Copy application code
COPY . .
# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV GRADIO_ALLOW_FLAGGING=never
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface/hub
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the application
CMD ["python", "app.py"]