11FROM continuumio/miniconda3 as upstream
22
3- # Update, change owner
4- RUN groupadd -r conda --gid 900 \
5- && chown -R :conda /opt/conda \
6- && chmod -R g+w /opt/conda \
7- && find /opt -type d | xargs -n 1 chmod g+s
8-
93# Reset and copy updated files with updated privs to keep image size down
104FROM mcr.microsoft.com/devcontainers/base:0-bullseye
115USER root
@@ -37,8 +31,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
3731 && ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \
3832 && echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \
3933 && echo "conda activate base" >> ~/.bashrc \
40- && groupadd -r conda --gid 900 \
41- && usermod -aG conda ${USERNAME} \
4234 && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/add-notice.sh
4335
4436# Copy environment.yml (if found) to a temp locaition so we update the environment. Also
@@ -47,16 +39,20 @@ COPY environment.yml* noop.txt /tmp/conda-tmp/
4739RUN 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 \
4840 && rm -rf /tmp/conda-tmp
4941
50- # Temporary: Upgrade python packages due to mentioned CVEs
51- # They are installed by the base image (continuumio/miniconda3) which does not have the patch.
52- RUN python3 -m conda update -y \
53- # https://github.com/advisories/GHSA-39hc-v87j-747x
54- cryptography \
55- # https://github.com/advisories/GHSA-r9hx-vwmv-q579
56- setuptools \
57- # https://github.com/advisories/GHSA-qwmp-2cf2-g9g6
58- wheel
42+ # [Optional] Uncomment this section to install updates/additional Python packages.
43+ # RUN python3 -m conda update -y \
44+ # <your-package-list-here>
5945
6046# [Optional] Uncomment this section to install additional OS packages.
6147# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6248# && apt-get -y install --no-install-recommends <your-package-list-here>
49+
50+ # Create conda group, update conda directory permissions,
51+ # add user to conda group
52+ # Note: We need to execute these commands after pip install / conda update
53+ # since pip doesn't preserve directory permissions
54+ RUN groupadd -r conda --gid 900 \
55+ && chown -R :conda /opt/conda \
56+ && chmod -R g+w /opt/conda \
57+ && find /opt -type d | xargs -n 1 chmod g+s \
58+ && usermod -aG conda ${USERNAME}
0 commit comments