FROM python:3.11-slim

# Set work directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Install base NATS dependency
RUN pip install --no-cache-dir nats-py>=2.6.0

# Service code will be mounted via ConfigMap at /app/services/think

# Create non-root user
RUN useradd -m -u 1000 service && chown -R service:service /app
USER service

# Expose port (if needed)
EXPOSE 8000

# Run the service (code mounted from ConfigMap)
CMD ["python", "-m", "services.think.think_service"]