aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-09-01 19:15:51 +0300
committerGitHub <noreply@github.com>2022-09-01 19:15:51 +0300
commitd50ef0016a2f8b3baeb88cd26f508f3b4b204573 (patch)
treecc2b181e7ebcab0290a727e04bc79d39e8ec5e01
parent964e4a340407fbd5ef3a2f186aa2167ecbbd8f4a (diff)
Revert "Anaconda - Clean up and shrink size (#121)" (#126)
* Revert "Anaconda - Clean up and shrink size (#121)" This reverts commit 964e4a340407fbd5ef3a2f186aa2167ecbbd8f4a. * bump version
-rw-r--r--src/anaconda/devcontainer-feature.json8
-rwxr-xr-xsrc/anaconda/install.sh42
2 files changed, 20 insertions, 30 deletions
diff --git a/src/anaconda/devcontainer-feature.json b/src/anaconda/devcontainer-feature.json
index 2f3a5bc..b6906ef 100644
--- a/src/anaconda/devcontainer-feature.json
+++ b/src/anaconda/devcontainer-feature.json
@@ -1,22 +1,20 @@
{
"id": "anaconda",
- "version": "1.0.4",
+ "version": "1.0.5",
"name": "Anaconda",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/anaconda",
"options": {
"version": {
"type": "string",
"proposals": [
- "latest",
- "4.11.0",
- "4.12.0"
+ "latest"
],
"default": "latest",
"description": "Select or enter an anaconda version."
}
},
"containerEnv": {
- "CONDA_DIR": "/opt/conda",
+ "CONDA_DIR": "/usr/local/conda",
"PATH": "${PATH}:${CONDA_DIR}/bin:"
}
}
diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh
index b657d1c..1802ce3 100755
--- a/src/anaconda/install.sh
+++ b/src/anaconda/install.sh
@@ -11,7 +11,7 @@
VERSION=${VERSION:-"latest"}
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
-CONDA_DIR="/opt/conda"
+CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"}
set -eux
export DEBIAN_FRONTEND=noninteractive
@@ -66,10 +66,6 @@ check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt-get update -y
apt-get -y install --no-install-recommends "$@"
-
- # Clean up
- apt-get clean -y
- rm -rf /var/lib/apt/lists/*
fi
}
@@ -81,33 +77,29 @@ if ! conda --version &> /dev/null ; then
usermod -a -G conda "${USERNAME}"
# Install dependencies
- check_packages curl ca-certificates gnupg2
+ check_packages wget ca-certificates
+ mkdir -p $CONDA_DIR
+ chown -R "${USERNAME}:conda" "${CONDA_DIR}"
+ chmod -R g+r+w "${CONDA_DIR}"
+
+ find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
echo "Installing Anaconda..."
- curl -sS https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > /usr/share/keyrings/conda-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list
-
- CONDA_PKG="conda=${VERSION}-0"
- if [ "${VERSION}" = "latest" ]; then
- CONDA_PKG="conda"
+ CONDA_VERSION=$VERSION
+ if [ "${VERSION}" = "latest" ] || [ "${VERSION}" = "lts" ]; then
+ CONDA_VERSION="2021.11"
fi
- check_packages $CONDA_PKG
-
- CONDA_SCRIPT="/opt/conda/etc/profile.d/conda.sh"
- . $CONDA_SCRIPT
-
- conda config --add channels conda-forge
- conda config --set channel_priority strict
- conda config --set env_prompt '({name})'
- echo "source ${CONDA_SCRIPT}" >> ~/.bashrc
-
- chown -R "${USERNAME}:conda" "${CONDA_DIR}"
- chmod -R g+r+w "${CONDA_DIR}"
+ su --login -c "wget -q https://repo.anaconda.com/archive/Anaconda3-${CONDA_VERSION}-Linux-x86_64.sh -O /tmp/anaconda-install.sh \
+ && /bin/bash /tmp/anaconda-install.sh -u -b -p ${CONDA_DIR}" ${USERNAME} 2>&1
- find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
+ if [ "${VERSION}" = "latest" ] || [ "${VERSION}" = "lts" ]; then
+ PATH=$PATH:${CONDA_DIR}/bin
+ conda update -y conda
+ fi
+ rm /tmp/anaconda-install.sh
updaterc "export CONDA_DIR=${CONDA_DIR}/bin"
fi