# set pip.conf RUN mkdir -p /root/.pip ADD ./pip.conf /root/.pip/pip.conf
# set sys_time RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# set utf-8 ENV LANG zh_CN.UTF-8 RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
# set default path WORKDIR /root
# to import bz2 RUN yum install -y bzip2-devel vim
# install python3 ADD ["Python-$PYTHON_VERSION.tgz","."] WORKDIR /root/Python-$PYTHON_VERSION #RUN ./configure --prefix=/root/app/python362 --enable-optimizations && \ RUN ./configure --enable-shared --prefix=/root/app/python$PYTHON_VERSION_SHORT --enable-optimizations && \ make && make install
# need cp libpython3.6m.so.1.0 to /usr/lib64 #RUN cp /root/app/python$PYTHON_VERSION_SHORT/lib/libpython3.5m.so.1.0 /usr/lib64 RUN cp /root/app/python$PYTHON_VERSION_SHORT/lib/libpython*.1.0 /usr/lib64
WORKDIR /root RUN rm -rf /root/Python-$PYTHON_VERSION
# link python to python3, call python3 with python ADD yum /usr/bin/ RUN chmod +x /usr/bin/yum ADD urlgrabber-ext-down /usr/libexec/ RUN chmod +x /usr/libexec/urlgrabber-ext-down WORKDIR /usr/bin/ RUN mv python python.bak && \ mv pip pip.bak RUN ln -s /root/app/python362/bin/python3 /usr/bin/python RUN ln -s /root/app/python362/bin/pip3 /usr/bin/pip
WORKDIR /root
RUN pip install --upgrade pip # install python package ADD ["requirements.txt", "."] RUN pip install -r requirements.txt
# install local package # COPY ["package name", "."] # RUN pip install -U package name