Browse Source

fix: Dockerfile

Zhang Li 1 year ago
parent
commit
f4165a2180
1 changed files with 12 additions and 8 deletions
  1. 12 8
      Dockerfile

+ 12 - 8
Dockerfile

@@ -1,3 +1,5 @@
+FROM condaforge/mambaforge:latest AS builder0
+
 FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 AS builder
 
 RUN sed -i 's#archive.ubuntu.com#mirrors.aliyun.com#g' /etc/apt/sources.list  \
@@ -40,17 +42,19 @@ CMD ["supervisord", "-n"]
 
 FROM builder as builder1
 
-ENV PYTHON_VERSION 3
-RUN chsh -s `which zsh`
-RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh  && \
-    chmod +x ~/miniconda.sh && \
-    ~/miniconda.sh -b -p /opt/conda && \
-    rm ~/miniconda.sh
+# ENV PYTHON_VERSION 3
+# RUN chsh -s `which zsh`
+# RUN curl -o ~/miniconda.sh -O  https://repo.anaconda.com/miniconda/Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh  && \
+#     chmod +x ~/miniconda.sh && \
+#     ~/miniconda.sh -b -p /opt/conda && \
+#     rm ~/miniconda.sh
+
+COPY --from=builder0 /opt/conda /opt/conda
 
 RUN ln /opt/conda/bin/conda /usr/local/bin/conda
 RUN conda init zsh
 # RUN conda install 'mamba<=1.4.5' -n base -c conda-forge
-# RUN ln /opt/conda/bin/mamba /usr/local/bin/mamba && mamba init zsh
+RUN ln /opt/conda/bin/mamba /usr/local/bin/mamba && mamba init zsh
 
 
 
@@ -78,7 +82,7 @@ FROM builder1 as builder2
 WORKDIR /workspace
 ADD environment.yml /environment.yml
 RUN sed -i 's#- paddlepaddle#- paddlepaddle-gpu==2.3.0.post110#g' /environment.yml && cat /environment.yml
-RUN conda update -n base -c defaults conda -y && conda env create -f /environment.yml && rm -rf /root/.cache
+RUN mamba update -n base -c defaults conda -y && mamba env create -f /environment.yml && rm -rf /root/.cache
 
 # RUN /opt/conda/envs/py38/bin/python -m ipykernel install --name py38 --display-name "py38"
 # RUN echo "c.MultiKernelManager.default_kernel_name = 'py38'">>/root/.jupyter/jupyter_notebook_config.py