Skip to content

Commit

Permalink
[miniconda] Refactor Dockerfile to sync with anaconda devcontianer (#…
Browse files Browse the repository at this point in the history
…741)

* Rework Dockerfile

* Enable tests

* Bump `base` image version
  • Loading branch information
alexander-smolyakov authored Sep 11, 2023
1 parent 444888a commit 10c097f
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/miniconda/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
FROM continuumio/miniconda3 as upstream

# Temporary: Upgrade python packages due to mentioned CVEs
# They are installed by the base image (continuumio/miniconda3) which does not have the patch.
RUN conda install \
# https://github.com/pyca/cryptography/security/advisories/GHSA-5cpq-8wj7-hf2v
pyopenssl=23.2.0 \
cryptography=41.0.2 \
# https://github.com/advisories/GHSA-j8r2-6x86-q33q
requests=2.31.0

# Reset and copy updated files with updated privs to keep image size down
FROM mcr.microsoft.com/devcontainers/base:0-bullseye
FROM mcr.microsoft.com/devcontainers/base:1-bullseye

ARG USERNAME=vscode

# Create the conda group and add remote user to the group
RUN groupadd -r conda --gid 900 \
&& usermod -aG conda ${USERNAME}

# Copy opt folder, set ownership and group permissions
COPY --chown=:conda --chmod=775 --from=upstream /opt/conda /opt/conda
RUN chmod =2775 /opt/conda

USER root
COPY --from=upstream /opt /opt/

# Copy scripts to execute
COPY add-notice.sh /tmp/library-scripts/

# Setup conda to mirror contents from https://github.com/ContinuumIO/docker-images/blob/master/miniconda3/debian/Dockerfile
Expand Down Expand Up @@ -39,25 +59,6 @@ COPY environment.yml* noop.txt /tmp/conda-tmp/
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 \
&& rm -rf /tmp/conda-tmp

# Temporary: Upgrade python packages due to mentioned CVEs
# They are installed by the base image (continuumio/miniconda3) which does not have the patch.
RUN conda install \
# https://github.com/pyca/cryptography/security/advisories/GHSA-5cpq-8wj7-hf2v
pyopenssl=23.2.0 \
cryptography=41.0.2 \
# https://github.com/advisories/GHSA-j8r2-6x86-q33q
requests=2.31.0

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# Create conda group, update conda directory permissions,
# add user to conda group
# Note: We need to execute these commands after pip install / conda update
# since pip doesn't preserve directory permissions
RUN groupadd -r conda --gid 900 \
&& chown -R :conda /opt/conda \
&& chmod -R g+w /opt/conda \
&& find /opt -type d | xargs -n 1 chmod g+s \
&& usermod -aG conda ${USERNAME}

0 comments on commit 10c097f

Please sign in to comment.