Skip to content

Commit dc263a9

Browse files
QPod0QPod0
QPod0
authored and
QPod0
committed
update python install
1 parent 329ccf3 commit dc263a9

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

docker_atom/work/script-setup.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,24 @@ setup_mamba() {
1616

1717

1818
setup_conda_postprocess() {
19+
ln -sf ${CONDA_PREFIX}/bin/python3 /usr/bin/python
20+
1921
# If python exists, set pypi source
2022
if [ -f "$(which python)" ]; then
2123
cat >/etc/pip.conf <<EOF
2224
[global]
2325
progress_bar=off
2426
root-user-action=ignore
27+
# retries=5
28+
# timeout=10
29+
trusted-host=pypi.python.org pypi.org files.pythonhosted.org
30+
# index-url=https://pypi.python.org/simple
2531
EOF
2632
fi
2733

34+
export PATH=$PATH:${CONDA_PREFIX}/bin
35+
printenv | sort
36+
2837
conda config --system --prepend channels conda-forge \
2938
&& conda config --system --set auto_update_conda false \
3039
&& conda config --system --set show_channel_urls true \
@@ -42,15 +51,17 @@ EOF
4251
}
4352

4453
setup_conda_with_mamba() {
54+
mkdir -pv ${CONDA_PREFIX}
4555
VERSION_PYTHON=$1; shift 1;
4656
mamba install -y --root-prefix="${CONDA_PREFIX}" --prefix="${CONDA_PREFIX}" -c "conda-forge" conda pip python="${VERSION_PYTHON:-3.10}"
47-
rm -rf /opt/conda/pkgs/*
57+
rm -rf ${CONDA_PREFIX}/pkgs/*
4858
setup_conda_postprocess
4959
}
5060

5161
setup_conda_download() {
62+
mkdir -pv ${CONDA_PREFIX}
5263
wget -qO- "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-$(arch).sh" -O /tmp/conda.sh
53-
bash /tmp/conda.sh -f -b -p /opt/conda
64+
bash /tmp/conda.sh -f -b -p ${CONDA_PREFIX}/
5465
rm -rf /tmp/conda.sh
5566
setup_conda_postprocess
5667
}

docker_base/Dockerfile

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@ FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}
66

77
LABEL maintainer="haobibo@gmail.com"
88

9-
ENV CONDA_PREFIX=/opt/conda/ \
10-
PATH=/opt/conda/bin:$PATH
9+
ENV CONDA_PREFIX=/opt/conda \
10+
PATH=$PATH:${CONDA_PREFIX}/bin
1111

12-
RUN source /opt/utils/script-utils.sh \
13-
&& source /opt/utils/script-setup.sh \
12+
RUN source /opt/utils/script-setup.sh \
13+
## source /opt/utils/script-utils.sh # already included in the `script-setup.sh`
1414
&& install_apt /opt/utils/install_list_base.apt \
1515
&& echo "Install tini" \
1616
&& setup_tini \
1717
&& echo "Install Mamba, Python, and Conda:" \
18-
&& mkdir -pv ${CONDA_PREFIX} \
19-
&& setup_mamba && setup_conda_with_mamba && install__clean \
20-
&& ln -sf /opt/conda/bin/python3 /usr/bin/python
18+
&& setup_mamba && setup_conda_with_mamba && install__clean
19+
2120
#&& echo "Replace system Python3 with Conda's Python - note that /bin and /sbin are symlinks of /usr/bin in docker image ubuntu" \
2221
#&& ln -sf /opt/conda/lib/python3.10 /opt/conda/lib/python3 \
2322
#&& cp --verbose -rn /usr/lib/python3.*/* /opt/conda/lib/python3/ \

0 commit comments

Comments
 (0)