@@ -3,9 +3,44 @@ FROM continuumio/anaconda3:2023.03-1 as upstream
33# Verify OS version is expected one
44RUN . /etc/os-release && if [ "${VERSION_CODENAME}" != "bullseye" ]; then exit 1; fi
55
6+ # Temporary: Upgrade python packages due to mentioned CVEs
7+ # They are installed by the base image (continuumio/anaconda3) which does not have the patch.
8+ RUN python3 -m pip install \
9+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21797
10+ --upgrade joblib \
11+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24065
12+ cookiecutter \
13+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34749
14+ mistune \
15+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34141
16+ numpy \
17+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25577
18+ werkzeug \
19+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32862
20+ nbconvert \
21+ # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28370
22+ tornado
23+
24+ RUN conda install \
25+ # https://github.com/advisories/GHSA-5cpq-8wj7-hf2v
26+ pyopenssl=23.2.0 \
27+ cryptography=41.0.2 \
28+ # https://github.com/advisories/GHSA-j8r2-6x86-q33q
29+ requests=2.31.0
30+
631# Reset and copy updated files with updated privs to keep image size down
7- FROM mcr.microsoft.com/devcontainers/base:0-bullseye
8- COPY --from=upstream /opt /opt/
32+ FROM mcr.microsoft.com/devcontainers/base:1-bullseye
33+
34+ ARG USERNAME=vscode
35+
36+ # Create the conda group and add remote user to the group
37+ RUN groupadd -r conda --gid 900 \
38+ && usermod -aG conda ${USERNAME}
39+
40+ # Copy opt folder, set ownership and group permissions
41+ COPY --chown=:conda --chmod=775 --from=upstream /opt/conda /opt/conda
42+ RUN chmod =2775 /opt/conda
43+
944USER root
1045
1146# Copy scripts to execute
@@ -43,24 +78,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
4378 && echo "conda activate base" >> ~/.bashrc \
4479 && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/add-notice.sh
4580
46- # Temporary: Upgrade python packages due to mentioned CVEs
47- # They are installed by the base image (continuumio/anaconda3) which does not have the patch.
48- RUN python3 -m pip install \
49- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21797
50- --upgrade joblib \
51- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24065
52- cookiecutter \
53- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34749
54- mistune \
55- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34141
56- numpy \
57- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25577
58- werkzeug \
59- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32862
60- nbconvert \
61- # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28370
62- tornado
63-
6481# Copy environment.yml (if found) to a temp location so we can update the environment. Also
6582# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
6683# COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
@@ -71,22 +88,3 @@ RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bi
7188# [Optional] Uncomment this section to install additional OS packages.
7289# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
7390# && apt-get -y install --no-install-recommends <your-package-list-here>
74-
75- # Temporary: Upgrade python packages due to mentioned CVEs
76- # They are installed by the base image (continuumio/anaconda3) which does not have the patch.
77- RUN conda install \
78- # https://github.com/advisories/GHSA-5cpq-8wj7-hf2v
79- pyopenssl=23.2.0 \
80- cryptography=41.0.2 \
81- # https://github.com/advisories/GHSA-j8r2-6x86-q33q
82- requests=2.31.0
83-
84- # Create conda group, update conda directory permissions,
85- # add user to conda group
86- # Note: We need to execute these commands after pip install / conda update
87- # since pip doesn't preserve directory permissions
88- RUN groupadd -r conda --gid 900 \
89- && chown -R :conda /opt/conda \
90- && chmod -R g+w /opt/conda \
91- && find /opt -type d | xargs -n 1 chmod g+s \
92- && usermod -aG conda ${USERNAME}
0 commit comments