# -----------------------------------------------------------------------------
# 1) Use official Python 3.6.10 slim image (based on Debian Buster)
# -----------------------------------------------------------------------------
FROM python:3.6.10-slim-buster

# -----------------------------------------------------------------------------
# 2) Install system packages & dev tools
# -----------------------------------------------------------------------------
RUN apt-get update && apt-get install -y \
    wget \
    curl \
    git \
    build-essential \
    libssl-dev \
    zlib1g-dev \
    libbz2-dev \
    libreadline-dev \
    libsqlite3-dev \
    libncurses5-dev \
    libncursesw5-dev \
    xz-utils \
    tk-dev \
    libffi-dev \
    liblzma-dev \
    ca-certificates \
    gfortran \
    && rm -rf /var/lib/apt/lists/*

# -----------------------------------------------------------------------------
# 3) Upgrade pip, setuptools, and wheel
# -----------------------------------------------------------------------------
RUN pip install --upgrade "pip<22" "setuptools<59" "wheel"

# -----------------------------------------------------------------------------
# 4) Install Python libraries
# -----------------------------------------------------------------------------
RUN pip install \
    numpy==1.17.4 \
    scipy==1.4.0 \
    scikit-learn==0.22 \
    pandas==0.25.3 \
    matplotlib==3.1.2 \
    seaborn==0.9.0 \
    joblib==0.14.1 \
    six==1.13.0 \
    python-dateutil==2.8.1 \
    pytz==2019.3 \
    tqdm==4.41.0 \
    cloudpickle==1.2.2 \
    networkx==2.4 \
    pymongo==3.10.0 \
    distlib==0.3.0 \
    filelock==3.0.12 \
    virtualenv==16.7.9 \
    importlib-metadata==1.3.0 \
    importlib-resources==1.0.2 \
    typing-extensions==3.7.4.1 \
    decorator==4.4.1 \
    future==0.18.2 \
    threadpoolctl==2.0.0 \
    zipp==0.6.0 \
    jupyter

# -----------------------------------------------------------------------------
# 5) Set the working directory
# -----------------------------------------------------------------------------
WORKDIR /app

# -----------------------------------------------------------------------------
# 6) Copy code
# -----------------------------------------------------------------------------
COPY . .

# -----------------------------------------------------------------------------
# 7) Default command
# -----------------------------------------------------------------------------
CMD ["/bin/bash"]
