Bootstrap: docker
From: centos:7.9.2009

%labels

    APPLICATION_NAME Miniconda ipython Environment - CentOS 7.9.2009
    APPLICATION_URL https://cw3e.ucsd.edu
    APPLICATION_VERSION 1.0

    AUTHOR_NAME Patrick Mulrooney
    AUTHOR_EMAIL pmulrooney@ucsd.edu

    CO_AUTHOR_NAME Jozette Conti
    CO_AUTHOR_EMAIL jlconti@ucsd.edu

    LAST_UPDATED 2023.07.14

%setup

%environment
    PATH=/opt/conda/bin:$PATH

%files

    ./ipython_requirements.txt /

%post -c /bin/bash

    export CONDA_VERSION=py310_23.3.1-0
    export SHA256SUM=aef279d6baea7f67940f16aad17ebe5f6aac97487c7c03466ff01f4819e5a651

    echo "=========== "
    yum install -y wget

    echo "=========== wget conda & verify"
    wget --quiet -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh && \
      echo "${SHA256SUM}  miniconda.sh" > miniconda.sha256 && \
      if ! sha256sum --strict -c miniconda.sha256; then exit 1; fi

    echo "=========== install conda"
    mkdir -p /opt && \
      sh miniconda.sh -b -p /opt/conda

    echo "=========== add links"
    ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
      echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
      echo "conda activate base" >> ~/.bashrc

    echo "=========== Cleanup"
    rm miniconda.sh miniconda.sha256 && \
      find /opt/conda/ -follow -type f -name '*.a' -delete && \
      find /opt/conda/ -follow -type f -name '*.js.map' -delete && \
      /opt/conda/bin/conda clean -afy

    echo "=========== Init envrionment"
    . /opt/conda/etc/profile.d/conda.sh

    echo "=========== Install from requirements.txt"
    /opt/conda/bin/conda install -y --file /ipython_requirements.txt

%runscript

    /bin/bash

%test

