Spaces:
Runtime error
Runtime error
FROM python:3.10-slim | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 \ | |
DEBIAN_FRONTEND=noninteractive \ | |
REQUESTS_TIMEOUT=30 | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
curl \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy requirements first to leverage Docker cache | |
COPY requirements.txt . | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Set up DNS configuration | |
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && \ | |
echo "nameserver 8.8.4.4" >> /etc/resolv.conf | |
# Expose port | |
EXPOSE 7860 | |
# Healthcheck | |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
CMD curl -f http://localhost:7860/health || exit 1 | |
# Command to run the application | |
CMD ["python", "app.py"] | |