FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ libmariadb-dev \ pkg-config \ wget \ curl \ # PDF processing tools poppler-utils \ # Clean up && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Install additional PDF processing libraries RUN pip install --no-cache-dir \ PyMuPDF \ pypdf \ pillow \ python-multipart \ httpx \ redis \ python-jose[cryptography] \ passlib \ bcrypt \ emails \ jinja2 # Copy application code COPY src/ ./src/ COPY assets/ ./assets/ # Create necessary directories RUN mkdir -p /app/uploads \ /app/templates \ /app/attachments \ /app/pdf_forms \ /app/logs # Set permissions RUN chmod -R 755 /app # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1 # Expose port EXPOSE 8000 # Run the application CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]