码迷,mamicode.com
首页 > 编程语言 > 详细

一个包含python和java环境的dockerfile

时间:2019-10-12 11:15:54      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:ati   java环境   bsp   uil   make   x86   sbin   $path   --   

现在一个项目中遇到python调用java的jar包的环境。为了方便发布,编写了这个dockerfile,作为基础镜像。

 

 1 #this docker file is used to build runtime environment.
 2 #The project is a python app which contains a java jar lib.
 3 FROM centos
 4 MAINTAINER mzyn22 <mzyn22@163.com>
 5 
 6 COPY ./requirements.txt /usr/local/src/requirements.txt
 7 # update software resource
 8 RUN yum -y install wget &&  9     cd /etc/yum.repos.d/  && 10     mkdir bak  && 11     mv *.repo bak  && 12     wget http://mirrors.aliyun.com/repo/Centos-7.repo  && 13     wget http://mirrors.aliyun.com/repo/epel-7.repo  && 14     yum -y install zlib-devel bzip2-devel openssl-devel openssl-static ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel lzma gcc  && 15     yum -y groupinstall "Development tools"  && 16     yum -y install java-1.8.0-openjdk.x86_64  && 17     cd /usr/local/src/  && 18     wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz  && 19     tar xvf Python-3.7.0.tar.xz  && 20     mv Python-3.7.0 /usr/local/python-3.7 && 21     cd /usr/local/python-3.7/ && 22     ./configure --prefix=/usr/local/sbin/python-3.7 && 23     make && make install && 24     rm -rf /usr/bin/python && 25     ln -sv /usr/local/sbin/python-3.7/bin/python3 /usr/bin/python && 26     ln -sv /usr/local/sbin/python-3.7/bin/python3 /usr/bin/python3 && 27     ln -sv /usr/local/sbin/python-3.7/bin/python3 /usr/bin/python37 && 28     sed -i 1s/python/python2.7/ /usr/bin/yum && 29     sed -i 1s/python/python2.7/ /usr/libexec/urlgrabber-ext-down && 30     sed -i 1s/python/python2.7/ /usr/bin/yum-config-manager && 31     
32     sed -i ‘$a\JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64‘ /etc/profile && 33     sed -i ‘$a\PATH=$PATH:$JAVA_HOME/bin‘ /etc/profile && 34     sed -i ‘$a\CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar‘ /etc/profile && 35     sed -i ‘$a\export JAVA_HOME CLASSPATH PATH‘ /etc/profile && 36     source /etc/profile && 37     ln -s /usr/local/sbin/python-3.7/bin/pip3 /usr/bin/pip && 38     pip install --upgrade pip
39 
40 RUN    pip install -r /usr/local/src/requirements.txt

 

一个包含python和java环境的dockerfile

标签:ati   java环境   bsp   uil   make   x86   sbin   $path   --   

原文地址:https://www.cnblogs.com/mzyn22/p/python-java-dockerfile-centos.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!