content: FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04
  
  ENV DEBIAN_FRONTEND noninteractive
  
  ### deps
  RUN apt-get -y update && \
      apt-get -y install fuse lsof procps curl bash tar wget locales && \
      rm -rf /var/lib/apt/lists/*
  
  RUN distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
            && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
            && curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container.list | \
               sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
               tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
  
  RUN apt-get -y update && \
      apt-get -y install ca-certificates openssh-client iptables nvidia-container-toolkit \
                         sox libsndfile1 ffmpeg libgomp1 jq && \
      rm -rf /var/lib/apt/lists/*
  
  ### Set the locale
  RUN locale-gen en_US.UTF-8
  ENV LANG en_US.UTF-8
  ENV LANGUAGE en_US:en
  ENV LC_ALL en_US.UTF-8
  RUN locale-gen --purge en_US.UTF-8
  
  ### dind installation, by https://github.com/cruizba/ubuntu-dind
  ENV DOCKER_CHANNEL=stable \
  	DOCKER_VERSION=20.10.9 \
  	DOCKER_COMPOSE_VERSION=1.29.2 \
  	DEBUG=false
  
  COPY docker/dind/docker_installer.sh /
  RUN chmod a+rx /docker_installer.sh
  RUN ./docker_installer.sh
  
  COPY docker/dind/modprobe /usr/local/bin/modprobe
  RUN chmod +x /usr/local/bin/modprobe
  
  VOLUME /var/lib/docker
  
  ### Docker compose installation
  RUN curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
  	&& chmod +x /usr/local/bin/docker-compose && docker-compose version
  
  ### java
  RUN apt-get -y update && \
      apt-get install -y openjdk-17-jdk && \
      rm -rf /var/lib/apt/lists/*
  ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64/
  RUN export JAVA_HOME
  
  ### conda setup
  ENV PATH="/root/miniconda3/bin:$PATH"
  ARG PATH="/root/miniconda3/bin:$PATH"
  RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
      && mkdir /root/.conda \
      && bash Miniconda3-latest-Linux-x86_64.sh -b \
      && rm -f Miniconda3-latest-Linux-x86_64.sh
  
  SHELL ["/bin/bash", "-c"]
  
  # for future interactive shell sessions
  RUN conda init bash
  
  COPY docker/requirements.txt /
  COPY docker/conda_prepare.sh /
  RUN chmod a+rx /conda_prepare.sh
  RUN ./conda_prepare.sh init
  