agentic-system / Dockerfile
Cascade Bot
Added Groq streaming support and optimizations - clean version
1d75522
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive \
REQUESTS_TIMEOUT=30 \
PYTHONPATH=/app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
dnsutils \
iputils-ping \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Set up DNS configuration with multiple DNS servers for redundancy
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && \
echo "nameserver 8.8.4.4" >> /etc/resolv.conf && \
echo "nameserver 1.1.1.1" >> /etc/resolv.conf && \
echo "options timeout:1 attempts:5" >> /etc/resolv.conf
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies with retry mechanism and explicit Gradio upgrade
RUN pip install --no-cache-dir -r requirements.txt || \
(sleep 5 && pip install --no-cache-dir -r requirements.txt) || \
(sleep 10 && pip install --no-cache-dir -r requirements.txt) && \
pip install --no-cache-dir gradio==4.44.1
# Copy application code
COPY . .
# Expose port
EXPOSE 7860
# Add network verification script
RUN echo '#!/bin/sh\n\
ping -c 1 huggingface.co || ping -c 1 8.8.8.8\n\
' > /healthcheck.sh && chmod +x /healthcheck.sh
# Healthcheck with more lenient settings
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=5 \
CMD /healthcheck.sh || exit 1
# Command to run the application
CMD ["python", "app.py"]