I created a python script using plotly dash to draw graphs, then using plotly-orca to export a static image of the created graph. I want to dockerise this script but my problem is I build and run the image i get a "The orca executable is required in order to export figures as static images" error. My question now is how do I include the executable as part of my docker image?
It's a bit complicated due to the nature of plotly-orca, but it can be done, according to this Dockerfile based on this advice. Add this to your 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/
I would just upgrade to plotly 4.9 or newer, and use kaleido through pip - an official substitute for Orca which has been a pain to setup with docker. https://plotly.com/python/static-image-export/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With