dubswayAgenticV2 / Dockerfile
peace2024's picture
docker update
9fe59b0
raw
history blame
1.38 kB
# Use a lightweight Python image optimized for ML workloads
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Set environment variables for better performance
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive \
HOME=/root
# Install system-level dependencies
RUN apt-get update && \
apt-get install -y \
ffmpeg \
libsndfile1 \
wget \
curl \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Configure git to avoid permission issues during HF build
RUN git config --global --add safe.directory /app && \
git config --global user.email "[email protected]" && \
git config --global user.name "peace2024"
# Copy requirements first to leverage Docker layer caching
COPY requirements-hf.txt .
# Upgrade pip and install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements-hf.txt
# Copy the entire app source code
COPY . .
# Create necessary directories
RUN mkdir -p vector_store logs
# Expose port 7860 (used by Hugging Face Spaces)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/docs || exit 1
# Run the FastAPI app via Uvicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]