Skip to content

Commit 1f4139d

Browse files
[anaconda] Reorg Dockerfile instructions to resolve issue with group permissions and PIP (#569)
* [anaconda] Reorg instructions to resolve group permission issue - Reorg instructions to resolve issues with PIP and group permission; - Remove temp patches that are no longer actual; - Add missing test; * Update `nbconvert` package * Reorg steps, update comments
1 parent 3c16ff8 commit 1f4139d

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

src/anaconda/.devcontainer/Dockerfile

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ FROM continuumio/anaconda3 as upstream
33
# Verify OS version is expected one
44
RUN . /etc/os-release && if [ "${VERSION_CODENAME}" != "bullseye" ]; then exit 1; fi
55

6-
# Update, change owner
7-
RUN groupadd -r conda --gid 900 \
8-
&& chown -R :conda /opt/conda \
9-
&& chmod -R g+w /opt/conda \
10-
&& find /opt -type d | xargs -n 1 chmod g+s
11-
126
# Reset and copy updated files with updated privs to keep image size down
137
FROM mcr.microsoft.com/devcontainers/base:0-bullseye
148
COPY --from=upstream /opt /opt/
@@ -47,8 +41,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
4741
&& ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \
4842
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \
4943
&& echo "conda activate base" >> ~/.bashrc \
50-
&& groupadd -r conda --gid 900 \
51-
&& usermod -aG conda ${USERNAME} \
5244
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/add-notice.sh
5345

5446
# Temporary: Upgrade python packages due to mentioned CVEs
@@ -58,26 +50,16 @@ RUN python3 -m pip install \
5850
--upgrade joblib \
5951
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24065
6052
cookiecutter \
61-
# https://github.com/advisories/GHSA-39hc-v87j-747x
62-
cryptography \
6353
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34749
6454
mistune \
6555
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34141
6656
numpy \
67-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23491
68-
certifi \
69-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897
70-
setuptools \
71-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40899
72-
future \
73-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40898
74-
wheel \
75-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32862
76-
nbconvert \
7757
# https://github.com/devcontainers/images/issues/486
7858
pyOpenssl \
7959
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25577
80-
werkzeug
60+
werkzeug \
61+
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32862
62+
nbconvert
8163

8264
# Copy environment.yml (if found) to a temp location so we can update the environment. Also
8365
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
@@ -89,3 +71,13 @@ RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bi
8971
# [Optional] Uncomment this section to install additional OS packages.
9072
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9173
# && apt-get -y install --no-install-recommends <your-package-list-here>
74+
75+
# Create conda group, update conda directory permissions,
76+
# add user to conda group
77+
# Note: We need to execute these commands after pip install / conda update
78+
# since pip doesn't preserve directory permissions
79+
RUN groupadd -r conda --gid 900 \
80+
&& chown -R :conda /opt/conda \
81+
&& chmod -R g+w /opt/conda \
82+
&& find /opt -type d | xargs -n 1 chmod g+s \
83+
&& usermod -aG conda ${USERNAME}

src/anaconda/test-project/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,8 @@ check "conda-install" bash -c "conda install -c conda-forge --yes pytorch"
6363
werkzeug_version=$(python -c "import werkzeug; print(werkzeug.__version__)")
6464
check-version-ge "werkzeug-requirement" "${werkzeug_version}" "2.2.3"
6565

66+
certifi_version=$(python -c "import certifi; print(certifi.__version__)")
67+
check-version-ge "certifi-requirement" "${certifi_version}" "2022.12.07"
68+
6669
# Report result
6770
reportResults

0 commit comments

Comments
 (0)