Skip to content

Commit a534c1f

Browse files
committed
pyenv better
1 parent 62dfcba commit a534c1f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,27 @@ RUN bash ./setup_18.x && $APT_INSTALL make build-essential net-tools apt-utils l
2222
libsqlite3-dev wget curl llvm libncurses-dev xz-utils tk-dev libffi-dev liblzma-dev git
2323

2424
# pyenv install python
25-
ENV PYENV_ROOT=/shared/.pyenv
26-
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:/$PYENV_ROOT/versions/$PYTHON_VERSION/bin:$PATH
27-
RUN chmod +x ./pyenv.run && ./pyenv.run && pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash
25+
RUN echo '# pyenv setup' > /etc/profile.d/pyenv.sh
26+
RUN echo 'export PYENV_ROOT=/shared/.pyenv' >> /etc/profile.d/pyenv.sh
27+
RUN echo 'export PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/versions/'$PYTHON_VERSION'/bin:$PATH' >> /etc/profile.d/pyenv.sh
28+
RUN echo 'eval "$(pyenv init -)"' >> /etc/profile.d/pyenv.sh
29+
RUN chmod +x /etc/profile.d/pyenv.sh
30+
RUN source /etc/profile.d/pyenv.sh && \
31+
chmod +x ./pyenv.run && \
32+
./pyenv.run && pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash && \
33+
update-alternatives --install /usr/bin/python python $PYENV_ROOT/shims/python3 0 && \
34+
update-alternatives --install /usr/bin/python3 python3 $PYENV_ROOT/shims/python3 0 && \
35+
update-alternatives --install /usr/local/bin/python python $PYENV_ROOT/shims/python3 0 && \
36+
update-alternatives --install /usr/local/bin/python3 python3 $PYENV_ROOT/shims/python3 0 && \
37+
update-alternatives --install /usr/local/bin/pip pip $PYENV_ROOT/shims/pip3 0 && \
38+
update-alternatives --install /usr/local/bin/pip3 pip3 $PYENV_ROOT/shims/pip3 0
2839

2940
# Fix vulnerabilities / outdated versions
3041
RUN $PIP_INSTALL --user --upgrade pip oauthlib pyjwt httplib2 "numpy==1.26.4" fonttools wheel "setuptools==79.0.1"
3142

3243
# install python packages..
3344
RUN $PIP_INSTALL ./bzt*whl chardet
45+
ENV PATH=/shared/.pyenv/versions/$PYTHON_VERSION/bin:$PATH
3446

3547
RUN $APT_UPDATE && $APT_INSTALL \
3648
unzip software-properties-common apt-transport-https \

0 commit comments

Comments
 (0)