Skip to content

Instantly share code, notes, and snippets.

@jprjr
Created November 26, 2013 23:09
Show Gist options
  • Select an option

  • Save jprjr/7667947 to your computer and use it in GitHub Desktop.

Select an option

Save jprjr/7667947 to your computer and use it in GitHub Desktop.

Revisions

  1. jprjr created this gist Nov 26, 2013.
    40 changes: 40 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    FROM tianon/centos-null:5.9

    RUN rpm -i http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
    RUN yum -y update
    RUN yum -y install gcc git curl make zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl openssl-devel


    RUN useradd -m python_user
    RUN ln -s /proc/self/fd /dev/fd

    WORKDIR /home/python_user
    USER python_user

    RUN git clone git://github.com/yyuu/pyenv.git .pyenv

    ENV HOME /home/python_user
    ENV PYENV_ROOT $HOME/.pyenv
    ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH

    RUN pyenv install 2.7.6
    RUN pyenv global 2.7.6
    RUN pyenv rehash

    RUN pip install --egg scons

    # Do whatever extra install things you need here...

    ADD info.py /home/python_user/info.py

    ENTRYPOINT ["python"]
    CMD ["info.py"]

    # build with something like
    # docker build -t python-demo .

    # to see current python version by running info.py
    # docker run python-demo

    # To run anything else
    # docker run python-demo /path/to/python/file
    8 changes: 8 additions & 0 deletions info.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/usr/bin/env python

    import platform
    import os

    print platform.platform()
    print platform.python_version()
    print os.getuid()