Visualizing the data jungle -- Part IV: Running Yape in a docker image
In this short article we talk about how to get Yape running in a docker container to avoid having to setup python on your machine.
It's been a while since the last article in this series, so let's recap quickly.
A common theme in the feedback I got over various channels was the difficulty setting up an environment to run any of these. So we decided to make it a bit easier and I teamed up with Murray to create a Dockerfile for his excellent tool Yape. Github page
Of course you'll have to have docker installed and running your machine for this.
A rather simple docker definition based on the official python images:
FROM python:3 WORKDIR . COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt COPY . .
Requirements.txt contains the packages necessary to get yape up and running in there:
altgraph==0.10.2 py-dateutil==2.2 bdist-mpkg==0.5.0 certifi==2017.7.27.1 cffi==1.10.0 chardet==3.0.4 idna==2.5 bokeh==0.12.6 macholib==1.5.1 matplotlib==2.0.2 pandas==0.20.3 modulegraph==0.10.4 numpy==1.13.1 py2app==0.7.3 pycparser==2.18 pyparsing==2.0.1 python-dateutil==1.5 pytz==2013.7 requests==2.18.3 six==1.4.1 urllib3==1.22 zope.interface==4.1.1
To build the image, simply check out the github repository and then run docker build:
git clone https://github.com/murrayo/yape.git docker build -t yape .
This will take a couple of minutes depending on the speed of your machine/internet connection.
Afterwards you can run yape on your pButtons file like this:
docker run -v `pwd`/in:/data --rm --name yape-test yape \ ./extract_pButtons.py -o /data \ /data/pButtons.html docker run -v `pwd`/in:/data --rm --name yape-test yape \ ./graph_pButtons.py -o /data/charts /data
in the current working directory and map it to
/data in the container. We'll get the pButtons.html from there and also output the graphs into that directory.
I had to add parameters to the scripts, we're merging them over into the official yape repository (pull request)