FROM python:3.12-slim

# Create non-root user
RUN useradd --create-home --shell /bin/bash appuser

WORKDIR /app

# Install markidocx
COPY pyproject.toml ./
COPY src/ ./src/
RUN pip install --no-cache-dir .

# Switch to non-root user
USER appuser

EXPOSE 8080

ENTRYPOINT ["markidocx", "serve"]
CMD ["--host", "0.0.0.0", "--port", "8080"]
