@@ -165,7 +165,7 @@ ARG PYTHON_VERSION
165165ARG PYENV_GIT_TAG
166166
167167ENV PYENV_ROOT=/opt/python
168- ENV PATH=$PATH:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/conan2/bin
168+ ENV PATH=$PATH:$PYENV_ROOT/shims:$PYENV_ROOT/bin
169169RUN curl -kSs https://pyenv.run | bash \
170170 && pyenv install -v $PYTHON_VERSION \
171171 && pyenv global $PYTHON_VERSION
@@ -182,16 +182,23 @@ RUN pip install --no-cache-dir -U \
182182 wheel \
183183 && pip install --no-cache-dir -U \
184184 Mercurial \
185- conan=="$CONAN_VERSION" \
186185 pipenv=="$PYTHON_PIPENV_VERSION" \
187186 poetry=="$PYTHON_POETRY_VERSION" \
188187 python-inspector=="$PYTHON_INSPECTOR_VERSION"
189- RUN mkdir /tmp/conan2 && cd /tmp/conan2 \
190- && wget https://github.com/conan-io/conan/releases/download/$CONAN2_VERSION/conan-$CONAN2_VERSION-linux-x86_64.tgz \
191- && tar -xvf conan-$CONAN2_VERSION-linux-x86_64.tgz\
192- # Rename the Conan 2 executable to "conan2" to be able to call both Conan version from the package manager.
193- && mkdir $PYENV_ROOT/conan2 && mv /tmp/conan2/bin $PYENV_ROOT/conan2/ \
194- && mv $PYENV_ROOT/conan2/bin/conan $PYENV_ROOT/conan2/bin/conan2
188+
189+ # Create conan environments
190+ COPY scripts/setup_conan.sh ${PYENV_ROOT}/bin/conan
191+ RUN eval "$(pyenv init - bash)" \
192+ && eval "$(pyenv virtualenv-init -)" \
193+ && pyenv virtualenv conan \
194+ && pyenv activate conan \
195+ && pip install conan==${CONAN_VERSION} \
196+ && pyenv deactivate \
197+ && pyenv virtualenv conan2 \
198+ && pyenv activate conan2 \
199+ && pip install conan==${CONAN2_VERSION} \
200+ && pyenv deactivate \
201+ && sudo chmod +x ${PYENV_ROOT}/bin/conan
195202
196203FROM scratch AS python
197204COPY --from=pythonbuild /opt/python /opt/python
@@ -463,7 +470,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
463470
464471# Python
465472ENV PYENV_ROOT=/opt/python
466- ENV PATH=$PATH:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/conan2/bin
473+ ENV PATH=$PATH:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PYENV_ROOT/plugins/pyenv-virtualenv/shims
467474COPY --from=python --chown=$USER:$USER $PYENV_ROOT $PYENV_ROOT
468475
469476# NodeJS
0 commit comments