add some tools to generate graphs and squash images

This commit is contained in:
2016-05-22 18:21:38 +01:00
parent f728b94bcf
commit e7c1ed31ac
11 changed files with 115 additions and 5 deletions

1
bin/dockviz Executable file
View File

@@ -0,0 +1 @@
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz $*

10
bin/dockviz-graphml Executable file
View File

@@ -0,0 +1,10 @@
DIR=`mktemp -d`
cd $DIR
wget -q https://bitbucket.org/dirkbaechle/dottoxml/raw/e285fccba8d51c6d814a83756935f3128972f0ea/src/X11Colors.py
wget -q https://bitbucket.org/dirkbaechle/dottoxml/raw/e285fccba8d51c6d814a83756935f3128972f0ea/src/dottoxml.py
wget -q https://bitbucket.org/dirkbaechle/dottoxml/raw/e285fccba8d51c6d814a83756935f3128972f0ea/src/dot.py
$DOCKER_HOME/bin/dockviz images -d > dockviz.dot
python dottoxml.py dockviz.dot dockviz.graphml
cat dockviz.graphml
cd - > /dev/null
rm -rf $DIR

2
bin/dockviz-xml Normal file
View File

@@ -0,0 +1,2 @@
DIR=`mkdir -t`
cd $DIR

View File

@@ -1,6 +1,5 @@
FILE=$DOCKER_HOME/images/$1.mk
if [ ! -e $FILE ]; then
DELETE=true
FILE="$(mktemp)"
cat <<- EOF > $FILE
include \$(DOCKER_HOME)/build/Makefile
@@ -11,7 +10,5 @@ EOF
fi
make -f $FILE build
CODE=$?
if [ ! -z ${DELETE+x} ]; then
rm $FILE
fi
rm $FILE
exit $CODE

15
bin/make-dependencies Executable file
View File

@@ -0,0 +1,15 @@
FILE=$DOCKER_HOME/images/$1.mk
if [ ! -e $FILE ]; then
FILE="$(mktemp)"
cat <<- EOF > $FILE
include \$(DOCKER_HOME)/build/Makefile
FROM = base:squash
NAME = $1
VERSION = latest
build: prepare $1
EOF
fi
make -Bnd -f $FILE build > $1.mk
cat $1.mk | make2graph | dot -Tpng -o $1.mk.png
cat $1.mk | make2graph -f x > $1.mk.xml
rm $FILE

5
bin/squash Executable file
View File

@@ -0,0 +1,5 @@
TREEFILE="$(mktemp)"
COMMANDFILE="$(mktemp)"
$DOCKER_HOME/bin/make/dockviz images -t --no-trunc > $TREEFILE
python3 $DOCKER_HOME/squash.py $TREEFILE $COMMANDFILE
. $COMMANDFILE

1
bin/total-size Normal file
View File

@@ -0,0 +1 @@
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t | grep Tags: | cut -d':' -f3 | cut -d' ' -f2 | awk '{d+=$1} END {print d}'