# NexusCRM + Lead Gen Pro: Unified Cloud Dockerfile # Optimized for Hugging Face Spaces (Docker SDK) # Using Python 3.10 slim for a balance of speed and stability FROM python:3.10-slim # Prevent Python from writing .pyc files and enable unbuffered logging ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ # Hugging Face Spaces port is 7860 PORT=7860 \ # Playwright headless requirements PLAYWRIGHT_BROWSERS_PATH=/app/pw-browsers # Install system dependencies required for Chromium and Playwright RUN apt-get update && apt-get install -y --no-install-recommends \ wget \ gnupg \ libnss3 \ libnspr4 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libdrm2 \ libxkbcommon0 \ libxcomposite1 \ libxdamage1 \ libxext6 \ libxfixes3 \ libxrandr2 \ libgbm1 \ libpango-1.0-0 \ libcairo2 \ libasound2 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies (including apify-client for the scraping engine) RUN pip install --no-cache-dir \ flask \ flask-cors \ playwright \ supabase \ pandas \ python-dotenv \ gunicorn \ apify-client # Install Playwright and the Chromium browser RUN playwright install chromium RUN playwright install-deps chromium # Preparation of the working environment # The entire folder (app.py, static/, lead_gen_pro/) is copied to /app COPY . . # Create a data directory for temporary SQLite files if it doesn't exist RUN mkdir -p /app/lead_gen_pro/data && chmod 777 /app/lead_gen_pro/data # Expose the HF port EXPOSE 7860 # Use gunicorn for a production-ready server in the cloud # We bind to 0.0.0.0 because it's a container CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", "--timeout", "0", "app:app"]