Bootstrap: docker
From: python:2.7-slim

%labels
    Author "zhxd"
    Version v1.0

%environment
    export PATH=/usr/local/bin:$PATH

%post
    # 使用阿里云镜像源
    sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
    sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list

    # 安装编译工具和依赖
    apt-get update && apt-get install -y \
        build-essential \
        git \
        && rm -rf /var/lib/apt/lists/*

    # 使用清华镜像源安装 Python 依赖
    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
        scikit-learn==0.18.1 \
        numpy==1.13.1 \
        scipy==0.19.0 \
        pandas==0.20.3

    # 创建工作目录
    mkdir -p /opt/Phylo-HMGP
    cd /opt/Phylo-HMGP

    # 克隆 Phylo-HMGP 仓库
    git clone https://github.com/ma-compbio/Phylo-HMGP.git .

    # 编译 C 模块
    python setup.py build
    python setup.py install

%runscript
    exec python /opt/Phylo-HMGP/phylo_hmgp.py "$@" 
