Skip to content

Commit 2917475

Browse files
committed
Merge branch 'release/0.50.5'
2 parents 1e50e51 + 7574828 commit 2917475

File tree

164 files changed

+508
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+508
-429
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ This project adheres to [WebDevOps.io Dockerfile](https://github.com/webdevops/D
44

55
## [1.0.0] - upcoming
66

7+
## [0.50.5] - 2016-06-10
8+
### Added
9+
- Added Magallanes deployer for samson-deployment
10+
### Changed
11+
- Improved documentation
12+
713
## [0.50.4] - 2016-06-06
814
### Removed
915
- Removed superfluous environment variables for PHP inside nginx

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ rebuild:
7272
push:
7373
BUILD_MODE=push make all
7474

75+
graph:
76+
python ./bin/diagram.py --dockerfile docker/ --filename documentation/docs/resources/images/docker-image-layout.gv
77+
7578
documentation:
7679
docker run -t -i --rm -p 8080:8000 -v "$$(pwd)/documentation/docs/:/opt/docs" webdevops/sphinx sphinx-autobuild --poll -H 0.0.0.0 /opt/docs html
7780

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Dockerfiles for various prebuilt docker containers
44

5-
[![Docker layout](documentation/webdevops.gv.png)](documentation/webdevops.gv.png)
5+
[![Docker layout](documentation/docs/resources/images/docker-image-layout.gv.png)](documentation/docs/resources/images/docker-image-layout.gv.png)
66

77
Dockerfile | Description | Depends on |
88
--------------------------------------------------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |

bin/diagram.py

Lines changed: 106 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,106 @@
1-
#!/usr/bin/env/python
2-
3-
from datetime import datetime
4-
import os
5-
import argparse
6-
import re
7-
from graphviz import Digraph
8-
import yaml
9-
10-
PATH = os.path.dirname(os.path.abspath(__file__))
11-
FROM_REGEX = re.compile(ur'FROM\s+(?P<image>[^\s:]+)(:(?P<tag>.+))?', re.MULTILINE)
12-
CONTAINERS = {}
13-
SUBGRAPH = {}
14-
EDGES = {}
15-
16-
def get_current_date():
17-
import datetime
18-
return datetime.date.today().strftime("%d.%m.%Y")
19-
20-
def processDockerfile(inputFile):
21-
outputFile = os.path.splitext(inputFile)
22-
outputFile = os.path.join(os.path.dirname(outputFile[0]),os.path.basename(outputFile[0]))
23-
24-
dockerImage = os.path.basename(os.path.dirname(os.path.dirname(outputFile)))
25-
dockerTag = os.path.basename(os.path.dirname(outputFile))
26-
27-
with open(inputFile, 'r') as fileInput:
28-
DockerfileContent = fileInput.read()
29-
data = ([m.groupdict() for m in FROM_REGEX.finditer(DockerfileContent)])[0]
30-
CONTAINERS["webdevops/%s"%dockerImage] = data.get('image')
31-
32-
def apply_styles(graph, styles):
33-
graph.graph_attr.update(
34-
('graph' in styles and styles['graph']) or {}
35-
)
36-
graph.node_attr.update(
37-
('nodes' in styles and styles['nodes']) or {}
38-
)
39-
graph.edge_attr.update(
40-
('edges' in styles and styles['edges']) or {}
41-
)
42-
return graph
43-
44-
def get_graph(conf,default_graph,name):
45-
46-
for group, group_attr in conf['diagram']['groups'].items():
47-
if name in group_attr['docker']:
48-
return SUBGRAPH[group]
49-
return default_graph
50-
51-
def build_graph(args):
52-
stream = open(os.path.dirname(__file__)+"/diagram.yml", "r")
53-
conf_diagram = yaml.safe_load(stream)
54-
dia = Digraph('webdevops', filename=args.filename, format=args.format, directory=args.path)
55-
dia = apply_styles(dia,conf_diagram['diagram']['styles'])
56-
dia.body.append(r'label = "\n\nWebdevops Containers\n at :%s"' % get_current_date() )
57-
58-
# Create subgraph
59-
for group, group_attr in conf_diagram['diagram']['groups'].items():
60-
SUBGRAPH[group] = Digraph("cluster_"+group);
61-
SUBGRAPH[group].body.append(r'label = "%s"' % group_attr['name'] )
62-
SUBGRAPH[group] = apply_styles(SUBGRAPH[group],group_attr['styles'] )
63-
for image, base in CONTAINERS.items():
64-
graph_image = get_graph(conf_diagram, dia, image)
65-
graph_base = get_graph(conf_diagram, dia, base)
66-
if "webdevops" in base:
67-
if graph_image == graph_base:
68-
graph_image.edge(base, image)
69-
else:
70-
graph_image.node(image)
71-
EDGES[image] = base
72-
else:
73-
graph_image.node(image)
74-
75-
76-
for name, subgraph in SUBGRAPH.items():
77-
dia.subgraph(subgraph)
78-
79-
for image, base in EDGES.items():
80-
dia.edge(base, image)
81-
return dia
82-
83-
def main(args):
84-
dockerfilePath = os.path.abspath(args.dockerfile)
85-
86-
# Parse Docker file
87-
for root, dirs, files in os.walk(dockerfilePath):
88-
89-
for file in files:
90-
if file.endswith("Dockerfile"):
91-
processDockerfile(os.path.join(root, file))
92-
93-
dia = build_graph(args)
94-
dia.render()
95-
96-
97-
if __name__ == '__main__':
98-
parser = argparse.ArgumentParser()
99-
parser.add_argument('-d','--dockerfile' ,help='path to the folder containing dockerfile analyze',type=str)
100-
parser.add_argument('-f','--filename' ,help='file output (default: webdevops.gv)',default='webdevops.gv',type=str)
101-
parser.add_argument('-F','--format' ,help='output format (default: png)',default='png',choices=('png','jpg','pdf','svg'))
102-
parser.add_argument('-p','--path' ,help='path output',default=os.path.dirname(__file__)+"/../",type=str)
103-
104-
args = parser.parse_args()
105-
106-
main(args)
1+
#!/usr/bin/env/python
2+
3+
from datetime import datetime
4+
import os
5+
import argparse
6+
import re
7+
from graphviz import Digraph
8+
import yaml
9+
10+
PATH = os.path.dirname(os.path.abspath(__file__))
11+
FROM_REGEX = re.compile(ur'FROM\s+(?P<image>[^\s:]+)(:(?P<tag>.+))?', re.MULTILINE)
12+
CONTAINERS = {}
13+
SUBGRAPH = {}
14+
EDGES = {}
15+
16+
def get_current_date():
17+
import datetime
18+
return datetime.date.today().strftime("%d.%m.%Y")
19+
20+
def processDockerfile(inputFile):
21+
outputFile = os.path.splitext(inputFile)
22+
outputFile = os.path.join(os.path.dirname(outputFile[0]),os.path.basename(outputFile[0]))
23+
24+
dockerImage = os.path.basename(os.path.dirname(os.path.dirname(outputFile)))
25+
dockerTag = os.path.basename(os.path.dirname(outputFile))
26+
27+
with open(inputFile, 'r') as fileInput:
28+
DockerfileContent = fileInput.read()
29+
data = ([m.groupdict() for m in FROM_REGEX.finditer(DockerfileContent)])[0]
30+
CONTAINERS["webdevops/%s"%dockerImage] = data.get('image')
31+
32+
def apply_styles(graph, styles):
33+
graph.graph_attr.update(
34+
('graph' in styles and styles['graph']) or {}
35+
)
36+
graph.node_attr.update(
37+
('nodes' in styles and styles['nodes']) or {}
38+
)
39+
graph.edge_attr.update(
40+
('edges' in styles and styles['edges']) or {}
41+
)
42+
return graph
43+
44+
def get_graph(conf,default_graph,name):
45+
46+
for group, group_attr in conf['diagram']['groups'].items():
47+
if name in group_attr['docker']:
48+
return SUBGRAPH[group]
49+
return default_graph
50+
51+
def build_graph(args):
52+
stream = open(os.path.dirname(__file__)+"/diagram.yml", "r")
53+
conf_diagram = yaml.safe_load(stream)
54+
dia = Digraph('webdevops', filename=args.filename, format=args.format, directory=args.path)
55+
dia = apply_styles(dia,conf_diagram['diagram']['styles'])
56+
dia.body.append(r'label = "\n\nWebdevops Images\n at :%s"' % get_current_date() )
57+
58+
# Create subgraph
59+
for group, group_attr in conf_diagram['diagram']['groups'].items():
60+
SUBGRAPH[group] = Digraph("cluster_"+group);
61+
SUBGRAPH[group].body.append(r'label = "%s"' % group_attr['name'] )
62+
SUBGRAPH[group] = apply_styles(SUBGRAPH[group],group_attr['styles'] )
63+
for image, base in CONTAINERS.items():
64+
graph_image = get_graph(conf_diagram, dia, image)
65+
graph_base = get_graph(conf_diagram, dia, base)
66+
if "webdevops" in base:
67+
if graph_image == graph_base:
68+
graph_image.edge(base, image)
69+
else:
70+
graph_image.node(image)
71+
EDGES[image] = base
72+
else:
73+
graph_image.node(image)
74+
75+
76+
for name, subgraph in SUBGRAPH.items():
77+
dia.subgraph(subgraph)
78+
79+
for image, base in EDGES.items():
80+
dia.edge(base, image)
81+
return dia
82+
83+
def main(args):
84+
dockerfilePath = os.path.abspath(args.dockerfile)
85+
86+
# Parse Docker file
87+
for root, dirs, files in os.walk(dockerfilePath):
88+
89+
for file in files:
90+
if file.endswith("Dockerfile"):
91+
processDockerfile(os.path.join(root, file))
92+
93+
dia = build_graph(args)
94+
dia.render()
95+
96+
97+
if __name__ == '__main__':
98+
parser = argparse.ArgumentParser()
99+
parser.add_argument('-d','--dockerfile' ,help='path to the folder containing dockerfile analyze',type=str)
100+
parser.add_argument('-f','--filename' ,help='file output (default: webdevops.gv)',default='webdevops.gv',type=str)
101+
parser.add_argument('-F','--format' ,help='output format (default: png)',default='png',choices=('png','jpg','pdf','svg'))
102+
parser.add_argument('-p','--path' ,help='path output',default=os.path.dirname(__file__)+"/../",type=str)
103+
104+
args = parser.parse_args()
105+
106+
main(args)

0 commit comments

Comments
 (0)