Skip to content

Commit d50ef00

Browse files
Revert "Anaconda - Clean up and shrink size (devcontainers#121)" (devcontainers#126)
* Revert "Anaconda - Clean up and shrink size (devcontainers#121)" This reverts commit 964e4a3. * bump version
1 parent 964e4a3 commit d50ef00

2 files changed

Lines changed: 20 additions & 30 deletions

File tree

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
{
22
"id": "anaconda",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"name": "Anaconda",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/anaconda",
66
"options": {
77
"version": {
88
"type": "string",
99
"proposals": [
10-
"latest",
11-
"4.11.0",
12-
"4.12.0"
10+
"latest"
1311
],
1412
"default": "latest",
1513
"description": "Select or enter an anaconda version."
1614
}
1715
},
1816
"containerEnv": {
19-
"CONDA_DIR": "/opt/conda",
17+
"CONDA_DIR": "/usr/local/conda",
2018
"PATH": "${PATH}:${CONDA_DIR}/bin:"
2119
}
2220
}

src/anaconda/install.sh

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
VERSION=${VERSION:-"latest"}
1212
USERNAME=${USERNAME:-"automatic"}
1313
UPDATE_RC=${UPDATE_RC:-"true"}
14-
CONDA_DIR="/opt/conda"
14+
CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"}
1515

1616
set -eux
1717
export DEBIAN_FRONTEND=noninteractive
@@ -66,10 +66,6 @@ check_packages() {
6666
if ! dpkg -s "$@" > /dev/null 2>&1; then
6767
apt-get update -y
6868
apt-get -y install --no-install-recommends "$@"
69-
70-
# Clean up
71-
apt-get clean -y
72-
rm -rf /var/lib/apt/lists/*
7369
fi
7470
}
7571

@@ -81,33 +77,29 @@ if ! conda --version &> /dev/null ; then
8177
usermod -a -G conda "${USERNAME}"
8278

8379
# Install dependencies
84-
check_packages curl ca-certificates gnupg2
80+
check_packages wget ca-certificates
8581

82+
mkdir -p $CONDA_DIR
83+
chown -R "${USERNAME}:conda" "${CONDA_DIR}"
84+
chmod -R g+r+w "${CONDA_DIR}"
85+
86+
find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
8687
echo "Installing Anaconda..."
8788

88-
curl -sS https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > /usr/share/keyrings/conda-archive-keyring.gpg
89-
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
90-
91-
CONDA_PKG="conda=${VERSION}-0"
92-
if [ "${VERSION}" = "latest" ]; then
93-
CONDA_PKG="conda"
89+
CONDA_VERSION=$VERSION
90+
if [ "${VERSION}" = "latest" ] || [ "${VERSION}" = "lts" ]; then
91+
CONDA_VERSION="2021.11"
9492
fi
9593

96-
check_packages $CONDA_PKG
97-
98-
CONDA_SCRIPT="/opt/conda/etc/profile.d/conda.sh"
99-
. $CONDA_SCRIPT
100-
101-
conda config --add channels conda-forge
102-
conda config --set channel_priority strict
103-
conda config --set env_prompt '({name})'
104-
echo "source ${CONDA_SCRIPT}" >> ~/.bashrc
105-
106-
chown -R "${USERNAME}:conda" "${CONDA_DIR}"
107-
chmod -R g+r+w "${CONDA_DIR}"
94+
su --login -c "wget -q https://repo.anaconda.com/archive/Anaconda3-${CONDA_VERSION}-Linux-x86_64.sh -O /tmp/anaconda-install.sh \
95+
&& /bin/bash /tmp/anaconda-install.sh -u -b -p ${CONDA_DIR}" ${USERNAME} 2>&1
10896

109-
find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
97+
if [ "${VERSION}" = "latest" ] || [ "${VERSION}" = "lts" ]; then
98+
PATH=$PATH:${CONDA_DIR}/bin
99+
conda update -y conda
100+
fi
110101

102+
rm /tmp/anaconda-install.sh
111103
updaterc "export CONDA_DIR=${CONDA_DIR}/bin"
112104
fi
113105

0 commit comments

Comments
 (0)