content: # -----
  # @file          : openparf.dockerfile
  # @project       : docker
  # @author        : Jing Mai <jingmai@pku.edu.cn>
  # @created date  : July 26 2023, 18:17:33, Wednesday
  # @brief         :
  # -----
  # Last Modified  : Feb 1 2024, 9:44:32, Thursday
  # Modified By    : Runzhe Tao <rztao@my.swjtu.edu.cn>
  # -----
  # @history :
  # =====================================================================================================
  # Date         	By     	    (version)	Comments
  # -------------	---------	---------	---------------------------------------------------------------
  # Feb 1 2024    RunzheTao   2.0         add python packages for `scripts/compute_sll_counts_tables.py`
  # =====================================================================================================
  # Copyright (c) 2020 - 2023 All Right Reserved, PKU-IDEA Group
  # -----
  # This header is generated by VSCode extension psi-header.
  #
  # Usage:
  #       docker build <dirname> -t <image name:tag name> -f <dockerfile name>
  # For example,
  #       docker build . -t openparf:2.0 -f ./openparf.dockerfile
  # Tip:
  #       When using Dockerfile to build an image, be sure to use a clean directory (preferably a new directory) to avoid other files in the directory.
  #       The build process will load all files in the current directory and cause disk overflow).
  
  ARG BASE_IMAGE=pytorch/pytorch:1.7.1-cuda11.0-cudnn8-devel
  
  FROM ${BASE_IMAGE} as dev-base
  LABEL maintainer="jingmai@pku.edu.cn"
  
  # Rotates to the keys used by NVIDIA as of 27-APR-2022.
  RUN rm /etc/apt/sources.list.d/cuda.list
  RUN rm /etc/apt/sources.list.d/nvidia-ml.list
  RUN apt-key del 7fa2af80
  RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
  RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
  
  # change apt source
  RUN sed -ri.bak -e 's/\/\/.*?(archive.ubuntu.com|mirrors.*?)\/ubuntu/\/\/mirrors.pku.edu.cn\/ubuntu/g' -e '/security.ubuntu.com\/ubuntu/d' /etc/apt/sources.list
  RUN apt-get update \
      && apt-get install -y --no-install-recommends \
      sudo \
      build-essential \
      ca-certificates \
      cmake \
      curl \
      wget \
      git \
      && update-ca-certificates
  
  
  RUN conda install -y wget doxygen ghostscript -c conda-forge
  RUN conda install -y cmake boost bison
  RUN pip install hummingbird-ml pyyaml networkx tqdm
  
  ENV CONDA_PREFIX=/opt/conda
  
  # install Gurobi 9.5.1
  # Credit to https://github.com/Gurobi/docker-optimizer/blob/master/9.5.1/Dockerfile
  ARG GRB_VERSION=9.5.1
  ARG GRB_SHORT_VERSION=9.5
  
  WORKDIR /opt
  
  RUN wget -v https://packages.gurobi.com/${GRB_SHORT_VERSION}/gurobi${GRB_VERSION}_linux64.tar.gz \
      && tar -xvf gurobi${GRB_VERSION}_linux64.tar.gz  \
      && rm -f gurobi${GRB_VERSION}_linux64.tar.gz \
      && mv -f gurobi* gurobi \
      && rm -rf gurobi/linux64/docs
  
  ENV GUROBI_HOME /opt/gurobi/linux64
  ENV PATH $PATH:$GUROBI_HOME/bin
  ENV LD_LIBRARY_PATH $GUROBI_HOME/lib
  ENV GRB_LICENSE_FILE /root/gurobi.lic
  
  WORKDIR /root
  
  USER root
  CMD  /bin/bash
  