# Dockerfile
FROM python:3.11-slim

WORKDIR /app

# Install system dependencies (including PostgreSQL client libs for psycopg2)
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Make entrypoint executable
RUN chmod +x entrypoint.sh

# Expose API port
EXPOSE 8000

# Use entrypoint script to run migrations, worker, and API
CMD ["./entrypoint.sh"]
