FROM python:3.12-slim

ARG BUILD_VERSION=unknown
ARG BUILD_TIME=unknown
ARG GIT_COMMIT=unknown

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    BUILD_VERSION=${BUILD_VERSION} \
    BUILD_TIME=${BUILD_TIME} \
    GIT_COMMIT=${GIT_COMMIT} \
    HF_HOME=/app/data/hf-cache \
    TRANSFORMERS_VERBOSITY=error \
    HF_HUB_DISABLE_PROGRESS_BARS=1

WORKDIR /app

RUN pip install --upgrade --no-cache-dir pip

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

COPY . .

RUN mkdir -p /app/data/logs /app/data/hf-cache

ENV PORT=5001 \
    HOST=0.0.0.0 \
    LOG_DIR=/app/data/logs \
    SAXO_TOKEN_FILE=/app/data/.saxo_token.json

EXPOSE 5001

CMD ["python", "dashboard.py"]
