Python3+Java8的 Docker 镜像
背景:
项目需要java调用python脚本,处理图片信息,因为是使用的docker镜像,容器化部署
所以需要在镜像中添加python基础镜像:
docker pull cherishpf/python3-java8:1.0
拉取镜像就可以作为基础镜像使用了
我这里的192.168.110.210:8081/library/jyc-python3-java8:v1.0.0 是改了名字而已
存在私有仓库里面
自己的dockerfile:
FROM 192.168.110.210:8081/library/jyc-python3-java8:v1.0.0
MAINTAINER jyc
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& mkdir -p /opt/project && mkdir -p /opt/image && mkdir -p /opt/log && mkdir -p /home/flir
RUN pip install --upgrade pip -i https://pypi.douban.com/simple
#-i https://pypi.douban.com/simple 加速
RUN apt-get update
RUN apt-get install exiftool -y # -y 不要省略,否则不成功
RUN pip install flirimageextractor -i https://pypi.douban.com/simple
RUN pip install loguru -i https://pypi.douban.com/simple
RUN pip install pandas -i https://pypi.douban.com/simple
EXPOSE 8182
WORKDIR /opt/project
COPY ./target/irCore.jar ./irCore.jar
# -Xms1024m -Xmx1024m -Xmn256m -Xss1m -XX:SurvivorRatio=8 -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true
ENV JAVA_OPS="-Xms1024m -Xmx1024m -Xmn256m -Xss1m -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true"
CMD java -jar $JAVA_OPS irCore.jar
不做过多解释了 看不懂的会先使用 或者去看下我其他docker方便的博文
这个就是我的镜像
这个是在另外一台服务器上运行的容器
我们进去看下:
/home/tbsoft# docker exec -it 146fce917880 /bin/bash
练习一把python 好玩吧 哈哈
看下脚本:
#coding=utf-8
import sys
import flirimageextractor
from matplotlib import cm
import pandas as pd
global img_png
global flir
def func(a):
global Fpath
global flir
flir = flirimageextractor.FlirImageExtractor(palettes=[cm.jet, cm.bwr, cm.gist_ncar])
flir.process_image(a)
# chuliphoto=flir.save_images()
t = flir.get_thermal_np()
T = pd.DataFrame(t)
#T.to_json('E:\\demo.dat')
#print(T.to_json())
return T.to_json()
if __name__ == '__main__':
a = []
for i in range(1, len(sys.argv)):
a.append((str(sys.argv[i])))
print(func(a[0]))
不解释 就是处理图片,,,,
java中使用的话后面再补充哈
总结:如果你也需要jdk8+python3 基础镜像的话 试试
docker pull cherishpf/python3-java8:1.0
参考:
https://blog.csdn.net/wangyhwyh753/article/details/103911904?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2.pc_relevant_antiscanv2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2.pc_relevant_antiscanv2&utm_relevant_index=5
https://blog.csdn.net/MaYuKang/article/details/123115410
https://blog.csdn.net/weixin_42442653/article/details/112886717?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-1.pc_relevant_antiscanv2&spm=1001.2101.3001.4242.2&utm_relevant_index=4