Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add this into a Dockerfile #98

Closed
escorciav opened this issue Apr 29, 2020 · 7 comments
Closed

How to add this into a Dockerfile #98

escorciav opened this issue Apr 29, 2020 · 7 comments

Comments

@escorciav
Copy link

Hi guys,

I want to add pyenv into a 3rdparty project using Docker. Do you mind to gimme a hand?

  • Could you please confirm that the corresponding header files such as Python.h can be found for a particular python version?

  • It's unclear how to do the PATH updates such that the container route to

Thanks in advance!

P.D. I know that it's not the principle solution, but I'm not familiar with the 3rdparty project and only know the basics of Docker. I do use Unix, but not very familiar with ubuntu (distro used in the Dockerfile of the project 😓)

@escorciav
Copy link
Author

I found this Dockerfile, but it looks a bit old.

@escorciav
Copy link
Author

escorciav commented Apr 29, 2020

this might be a better starting point

@robnagler
Copy link

@escorciav some tips on Docker:

  1. Write a single script, e.g. build.sh
  2. Test it by running docker interactively, e.g. docker run -it -v $PWD:/vagrant <image> bash
  3. Use a very simple Dockerfile to build, once you have debugged the script, e.g.
FROM <image>
USER root
ADD . /vagrant
RUN build.sh

Note that I use /vagrant here, because I work primary in VMs. We use the same scripts to build Vagrant boxes.

@escorciav
Copy link
Author

escorciav commented Apr 29, 2020

Thanks for getting back.... based on the repo that I mentioned above, I used the snipped below in my Dockerfile. It did the job for me:

ENV PYENV_ROOT="/data/.pyenv" \
    PATH="/data/.pyenv/bin:/data/.pyenv/shims:$PATH"

RUN mkdir -p /data

WORKDIR /data

RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

RUN pyenv update \
    && pyenv install 3.6.8 \
    && pyenv virtualenv 3.6.8 general \
    && pyenv global general

I let the image building... 🤞 the other packages (build by cmake) will find the appropriate Python.h.

@escorciav
Copy link
Author

escorciav commented Apr 29, 2020

Closing the issue as it looks out of the scope of this repo. Sorry about that.

Stay safe and healthy!

@joshfriend
Copy link
Member

No worries! Thank's for posting your solution :)

@escorciav
Copy link
Author

Minor update the snippet above likely built my image successfully (opencv, and other gazzilion of dependencies 😅 ).

I only have an issue with a particular dependency (decord) where the Dockerfile is trying to do python setup.py install --user. Even in that case pyenv pointed towards setuptools documentation for alternatives on how to build it 👏 . I skipped it as I don't plan to use that for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants