@@ -43,13 +43,22 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
4343 && echo "conda activate base" >> ~/.bashrc \
4444 && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/add-notice.sh
4545
46+ # Copy environment.yml (if found) to a temp location so we can update the environment. Also
47+ # copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
48+ # COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
49+ COPY environment.yml* noop.txt /tmp/conda-tmp/
50+ RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
51+ && rm -rf /tmp/conda-tmp
52+
4653# We need to execute pip install / conda update commands under
4754# container user since pip doesn't preserve directory permissions
4855USER ${USERNAME}
4956
5057# Temporary: Upgrade python packages due to mentioned CVEs
5158# They are installed by the base image (continuumio/anaconda3) which does not have the patch.
52- RUN python3 -m pip install \
59+ RUN \
60+ # Install packages via pip
61+ python3 -m pip install \
5362 # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21797
5463 --upgrade joblib \
5564 # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24065
@@ -67,22 +76,9 @@ RUN python3 -m pip install \
6776 # https://github.com/advisories/GHSA-47fc-vmwq-366v
6877 torch==1.13.1 \
6978 # https://github.com/advisories/GHSA-282v-666c-3fvg
70- transformers==4.30.0
71-
72- # Copy environment.yml (if found) to a temp location so we can update the environment. Also
73- # copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
74- # COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
75- COPY environment.yml* noop.txt /tmp/conda-tmp/
76- RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
77- && rm -rf /tmp/conda-tmp
78-
79- # [Optional] Uncomment this section to install additional OS packages.
80- # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
81- # && apt-get -y install --no-install-recommends <your-package-list-here>
82-
83- # Temporary: Upgrade python packages due to mentioned CVEs
84- # They are installed by the base image (continuumio/anaconda3) which does not have the patch.
85- RUN conda install \
79+ transformers==4.30.0 \
80+ # Install packages via conda
81+ && conda install \
8682 # https://github.com/advisories/GHSA-5cpq-8wj7-hf2v
8783 pyopenssl=23.2.0 \
8884 cryptography=41.0.2 \
@@ -93,3 +89,7 @@ RUN conda install \
9389
9490# Switch back to the root user for backward compatibility
9591USER root
92+
93+ # [Optional] Uncomment this section to install additional OS packages.
94+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
95+ # && apt-get -y install --no-install-recommends <your-package-list-here>
0 commit comments