# TransLynx Backend Dockerfile

FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
# NOTE: LibreOffice and OpenSSH removed - now using host-based services:
#   - LibreOffice API: http://localhost:2002 (planned)
#   - WhatsApp sender: http://localhost:3001
RUN apt-get update && apt-get install -y \
    gcc curl \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Expose port
EXPOSE 8001

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8001/health || exit 1

# Run uvicorn directly (FastAPI handles LibreOffice lifecycle via startup/shutdown events)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"]
