-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdive_html.j2
169 lines (161 loc) · 4.57 KB
/
dive_html.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- basic bootstrap css/js just to make it a bit nicer to look at -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
{% set dockerfile_ref = ['ADD', 'ARG', 'CMD', 'COPY', 'ENTRYPOINT', 'ENV', 'EXPOSE', 'FROM', 'HEALTHCHECK', 'LABEL', 'MAINTAINER', 'ONBUILD', 'RUN', 'SHELL', 'STOPSIGNAL', 'USER', 'VOLUME', 'WORKDIR'] %}
<style>
/* the whole style looks dumb, but anyway... */
/* severities are color coded according to CVE levels */
.digest {
color: lightgray;
}
.cmd-ADD {
border-left: 1em solid green;
}
.cmd-ARG {
border-left: 1em solid orange;
}
.cmd-CMD {
border-left: 1em solid blue;
}
.cmd-COPY {
border-left: 1em solid green;
}
.cmd-ENTRYPOINT {
border-left: 1em solid blue;
}
.cmd-ENV {
border-left: 1em solid orange;
}
.cmd-EXPOSE {
border-left: 1em solid violet;
}
.cmd-FROM {
border-left: 1em solid pink;
}
.cmd-HEALTHCHECK {
border-left: 1em solid violet;
}
.cmd-LABEL {
border-left: 1em solid gray;
}
.cmd-MAINTAINER {
border-left: 1em solid gray;
}
.cmd-ONBUILD {
border-left: 1em solid violet;
}
.cmd-RUN {
border-left: 1em solid red;
}
.cmd-SHELL {
border-left: 1em solid orange;
}
.cmd-STOPSIGNAL {
border-left: 1em solid violet;
}
.cmd-USER {
border-left: 1em solid orange;
}
.cmd-VOLUME {
border-left: 1em solid violet;
}
.cmd-WORKDIR {
border-left: 1em solid orange;
}
.cmd-UNKNOWN {
border-left: 1em solid black;
}
#footer {
margin-bottom: 1em;
padding-bottom: 1em;
}
</style>
</head>
<body>
<!-- dummy section to redirect 'Back to top' hrefs -->
<div id="top">
<br/>
</div>
<!-- general info -->
<div class="container info-general">
<div class="row">
<div class="col-md-12 text-center"><b>General info</b></div>
</div>
</div>
<div class="container info-general">
<div class="container">
<div class="row">
<div class="col-md-3 text-right"><b>image</b></div>
<div class="col-md-9">{{ data.image.sizeBytes | filesizeformat }}</div>
</div>
<div class="row">
<div class="col-md-3 text-right"><b>inefficient</b></div>
<div class="col-md-9">{{ data.image.inefficientBytes | filesizeformat }}</div>
</div>
<div class="row">
<div class="col-md-3 text-right"><b>efficiency score</b></div>
<div class="col-md-9">{{ "%3.0f" | format(data.image.efficiencyScore*100) }}%</div>
</div>
</div>
</div>
<!-- most big files in image -->
<div id="files" class="container info-general">
<div class="row">
<div class="col-md-12 text-center"><b>Files refs</b></div>
</div>
</div>
<div class="container">
{%- for ref in data.image.fileReference %}
<div class="container">
<div class="row">
<div class="col-md-1"><b>count</b> {{ ref.count }}</div>
<div class="col-md-1">{{ ref.sizeBytes | filesizeformat }}</div>
<div class="col-md-10">{{ ref.file | e }}</div>
</div>
</div>
{% endfor %}
</div>
<!-- layers -->
<div id="layers" class="container info-general">
<div class="row">
<div class="col-md-12 text-center"><b>Image Build</b></div>
</div>
</div>
<div class="container">
{%- for layer in data.layer %}
{%- set cmd_list = layer.command.split(' ', 1) %}
{%- set css_class = 'UNKNOWN' %}
{%- if cmd_list[0] == '#(nop)' %}
{%- set css_class = layer.command.split(' ')[1] %}
{%- else %}
{%- if cmd_list in dockerfile_ref %}
{%- set css_class = layer.command.split(' ')[0] %}
{%- endif %}
{%- endif %}
<div class="container">
<div class="row">
<div class="col-md-1">
<b>index</b>: {{ layer.index }}
</div>
<div class="col-md-1" text-right>{{ layer.sizeBytes | filesizeformat }}</div>
<div class="col-md-10 cmd-{{ css_class }}">
{{ layer.command | e -}}
<br/>
<p class="digest"><b>digestId</b>: {{ layer.digestId }}</p>
</div>
</div>
</div>
{%- endfor %}
</div>
<!-- footer for.. nothing -->
<div id="footer" class="container">
<div class="row">
<div class="col-md-12 text-center">
</div>
</div>
</div>
</body>
</html>