FROM python:3.12-slim

WORKDIR /app

# Declare build-time arguments
ARG BITBUCKET_USER
ARG BITBUCKET_PASS

RUN apt-get update && apt-get install -y git

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && \
    pip install --no-cache-dir \
    git+https://${BITBUCKET_USER}:${BITBUCKET_PASS}@bitbucket.org/credit_fair/python-core.git@dev#subdirectory=utils

# Copy source
COPY src/ ./src/

EXPOSE 8000

CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
