k8s构建镜像-基于centos的python环境+pip
FROM centos:7.4.1708
#维护者信息
MAINTAINER by icdss
# 标签
LABEL version="1.0"
# 安装依赖
RUN yum -y update
RUN yum groupinstall -y development
RUN yum provides '*/applydeltarpm'
RUN yum install deltarpm -y
RUN yum -y install epel-release && \
yum -y install wget && \
yum -y install tar
RUN yum -y install gcc gcc-c++ make openssl-devel python-devel glibc-common \
zlib-devel bzip2-devel ncurses-devel \
sqlite-devel readline-devel tk-devel \
gdbm-devel db4-devel libpcap-devel xz-devel
RUN yum -y install systemd-devel
RUN yum -y install kde-l10n-Chinese
# 安装jdk1.8
RUN mkdir -p /usr/local/jdk1.8.0_181
COPY jdk1.8.0_181 /usr/local/jdk1.8.0_181
ENV JAVA_HOME /usr/local/jdk1.8.0_181
ENV PATH $PATH:$JAVA_HOME/bin
ENV CLASSPATH .:$CLASSPATH:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
#ENV PYTHONHOME /usr/local
#ENV PYTHONPATH $PYTHONHOME:/usr/lib64/python2.7
ENV LD_LIBRARY_PATH /MIIP/lib_linux:$LD_LIBRARY_PATH
# 安装python
RUN mkdir -p /tmp
ADD https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz /tmp/
RUN cd /tmp && tar -xvzf Python-2.7.6.tgz
WORKDIR /tmp/Python-2.7.6
RUN ./configure --prefix=/usr/local && \
make && \
make altinstall
# create a symlink python -> python2.7
RUN ln -s /usr/local/bin/python2.7 /usr/local/bin/python
# Install setuptools
WORKDIR /tmp
ADD https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz /tmp/
RUN tar -xvzf setuptools-1.4.2.tar.gz
WORKDIR /tmp/setuptools-1.4.2
RUN python2.7 setup.py install && \
# Install pip and virtualenv
curl https://bootstrap.pypa.io/get-pip.py | python2.7 - && \
pip install virtualenv
# install shapely dependencies, should be installed after python
#RUN yum install -y geos geos-devel geos-python
#声明环境变量
#ENV PATH $PATH:$PYTHONHOME/bin:/usr/local/bin/python
#ENV PYTHONPATH /MIIP/lib_linux:/usr/lib64/python2.7
#业务挂载
WORKDIR /
RUN mkdir /MIIP
ADD icdss_prompt.jar icdss_prompt.jar
ADD MIIP/ /MIIP/
#语言
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
ENV LC_ALL "zh_CN.UTF-8"
ENV JAVA_OPTS=""
ENV input_args=""
#ENV LANG en_US.UTF-8
#ENV LANGUAGE en_US:en
#ENV LC_ALL en_US.UTF-8
# pip安装依赖
RUN pip install Flask==1.0.2
RUN pip install gunicorn==19.9.0
#RUN pip install scikit-learn==0.19.2
#RUN pip install numpy==1.15.4
#RUN pip install jieba==0.39
#RUN pip install Jinja2==2.10
#RUN pip install xlrd==1.2.0
#RUN pip install XlsxWriter
#RUN pip install scipy
#RUN pip install gevent
#RUN touch nohup.out
#CMD tail -f nohup.out
#ENTRYPOINT java $JAVA_OPTS -jar ./*.jar $input_args