Skip to content

Instantly share code, notes, and snippets.

@azimut
Last active April 10, 2017 22:19
Show Gist options
  • Save azimut/74e2702074bd179953753c360bf17a1a to your computer and use it in GitHub Desktop.
Save azimut/74e2702074bd179953753c360bf17a1a to your computer and use it in GitHub Desktop.
gentoo-bb gentoobb namespace
#!/usr/bin/env python2
import networkx as nx
import os
# decorator==4.0.10
# networkx==1.11
# pydotplus==2.0.2
# pyparsing==2.1.10
#
# http://networkx.github.io/documentation/development/examples/drawing/weighted_graph.html
#
# $ dot -Grankdir=RL g.dot -Tpng -o g.png
G = nx.DiGraph()
for path,dirs,files in os.walk(os.getenv('HOME')+'/projects/kubler/dock/kubler/images/'):
if 'build.conf' in files:
docker_image = path.split('/')[-1:][0]
G.add_node(docker_image)
with open(path+'/build.conf') as f:
for line in f:
if line.startswith('IMAGE_PARENT'):
docker_dep = line.split('=')[-1:][0]\
.replace('"','')\
.split('/')[-1:][0]\
.rstrip()
G.add_node(docker_dep)
G.add_edge(docker_image,docker_dep)
nx.drawing.nx_pydot.write_dot(G,"g.dot")
strict digraph "" {
busybox;
cadvisor;
nodejs;
kibana;
"nginx-proxy-conf";
mysql;
"ruby-gcc";
"log-collector";
gcc;
mariadb;
glibc;
redis;
s6;
grafana;
python3;
plantuml;
"nginx-php7";
postgres;
webhook;
influxdb;
"riemann-dash";
nginx;
memcache;
"nginx-proxy";
"jdk-oracle";
"docker-registry";
ruby;
opensmtpd;
bash;
python2;
"jre-oracle";
"nginx-php5.6";
riemann;
tomcat;
openssl;
"jdk-icedtea";
elasticsearch;
clojure;
cadvisor -> glibc;
nodejs -> openssl;
kibana -> glibc;
"nginx-proxy-conf" -> s6;
mysql -> bash;
"ruby-gcc" -> gcc;
"log-collector" -> "ruby-gcc";
gcc -> bash;
mariadb -> bash;
glibc -> busybox;
redis -> s6;
s6 -> glibc;
grafana -> openssl;
python3 -> bash;
plantuml -> tomcat;
"nginx-php7" -> nginx;
postgres -> bash;
webhook -> bash;
influxdb -> glibc;
"riemann-dash" -> "ruby-gcc";
nginx -> openssl;
memcache -> bash;
"nginx-proxy" -> nginx;
"jdk-oracle" -> gcc;
"docker-registry" -> openssl;
ruby -> bash;
opensmtpd -> openssl;
bash -> openssl;
python2 -> bash;
"jre-oracle" -> bash;
"nginx-php5.6" -> nginx;
riemann -> clojure;
tomcat -> "jre-oracle";
openssl -> s6;
"jdk-icedtea" -> gcc;
elasticsearch -> "jre-oracle";
clojure -> "jre-oracle";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment