gpt4 book ai didi

python-3.x - Docker 和 Plotly

转载 作者:行者123 更新时间:2023-12-03 10:04:06 27 4
gpt4 key购买 nike

我使用 plotly dash 创建了一个 python 脚本来绘制图形,然后使用 plotly-orca 导出所创建图形的静态图像。我想对这个脚本进行 dockerise,但我的问题是我构建并运行图像我得到一个“需要 orca 可执行文件才能将数字导出为静态图像”错误。我现在的问题是如何将可执行文件作为 docker 镜像的一部分包含在内?

最佳答案

由于 plotly-orca 的性质,这有点复杂,但根据 this Dockerfile 可以做到。基于 this advice .将此添加到您的 Dockerfile :

# Download orca AppImage, extract it, and make it executable under xvfb
RUN apt-get install --yes xvfb
RUN wget https://github.com/plotly/orca/releases/download/v1.1.1/orca-1.1.1-x86_64.AppImage -P /home
RUN chmod 777 /home/orca-1.1.1-x86_64.AppImage

# To avoid the need for FUSE, extract the AppImage into a directory (name squashfs-root by default)
RUN cd /home && /home/orca-1.1.1-x86_64.AppImage --appimage-extract
RUN printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /home/squashfs-root/app/orca "$@"' > /usr/bin/orca
RUN chmod 777 /usr/bin/orca
RUN chmod -R 777 /home/squashfs-root/

关于python-3.x - Docker 和 Plotly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54112336/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com