Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker-images
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sandro
docker-images
Commits
cb0a115e
Verified
Commit
cb0a115e
authored
3 years ago
by
nd
Browse files
Options
Downloads
Patches
Plain Diff
add an image to simply create directory listenings
parent
b2680b09
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
Dockerfile.debian-bullseye-directory-listening
+8
-0
8 additions, 0 deletions
Dockerfile.debian-bullseye-directory-listening
directory-listening/create-index.py
+100
-0
100 additions, 0 deletions
directory-listening/create-index.py
with
109 additions
and
1 deletion
.gitlab-ci.yml
+
1
−
1
View file @
cb0a115e
...
@@ -8,4 +8,4 @@ build-buster:
...
@@ -8,4 +8,4 @@ build-buster:
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-buster-mkdocs --destination $CI_REGISTRY_IMAGE/buster-mkdocs:$CI_COMMIT_TAG
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-buster-mkdocs --destination $CI_REGISTRY_IMAGE/buster-mkdocs:$CI_COMMIT_TAG
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-buster-hugo --destination $CI_REGISTRY_IMAGE/buster-hugo:$CI_COMMIT_TAG
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-buster-hugo --destination $CI_REGISTRY_IMAGE/buster-hugo:$CI_COMMIT_TAG
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-bullseye-hugo --destination $CI_REGISTRY_IMAGE/bullseye-hugo:$CI_COMMIT_TAG
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-bullseye-hugo --destination $CI_REGISTRY_IMAGE/bullseye-hugo:$CI_COMMIT_TAG
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.debian-bullseye-directory-listening --destination $CI_REGISTRY_IMAGE/bullseye-directory-listening:$CI_COMMIT_TAG
This diff is collapsed.
Click to expand it.
Dockerfile.debian-bullseye-directory-listening
0 → 100644
+
8
−
0
View file @
cb0a115e
FROM debian:bullseye
RUN apt-get -qq update && \
apt-get -qq dist-upgrade && \
apt-get -qq install python3 python3-jinja2 && \
apt-get -qq clean
COPY directory-listening/create-index.py /usr/local/bin/create-index
This diff is collapsed.
Click to expand it.
directory-listening/create-index.py
0 → 100755
+
100
−
0
View file @
cb0a115e
#!/usr/bin/env python3
import
jinja2
import
os
import
sys
from
datetime
import
datetime
def
timestamp_to_datetime
(
timestamp
):
return
datetime
.
fromtimestamp
(
timestamp
)
def
main
(
inputfolder
,
outputfolder
,
ignore_files
):
jinjaenv
=
jinja2
.
Environment
(
autoescape
=
jinja2
.
select_autoescape
())
jinjaenv
.
filters
[
"
timestamp_to_datetime
"
]
=
timestamp_to_datetime
template
=
jinjaenv
.
from_string
(
"""
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=
"
content-type
"
content=
"
text/html; charset=utf-8
"
>
<meta name=
"
viewport
"
content=
"
width=device-width
"
>
<style type=
"
text/css
"
>
body,html {
background: #fff;
font-family:
"
Bitstream Vera Sans
"
,
"
Lucida Grande
"
,
"
Lucida Sans Unicode
"
,Lucidux,Verdana,Lucida,sans-serif;
}
tr:nth-child(even) {
background:#f4f4f4;
}
th,td {
padding:0.1em 0.5em;
}
th {
text-align:left;
font-weight:bold;
background:#eee;
border-bottom:1px solid #aaa;
}
#list {
border:1px solid #aaa;
width:100%;
}
a {
color:#a33;
}
a:hover {
color:#e33;
}
</style>
</head>
<body>
<h1>Index of /{{ path }}</h1>
<table id=
"
list
"
>
<thead>
<tr>
<th style=
"
width:55%
"
>
File Name
</th>
<th style=
"
width:20%
"
>
File Size</th>
<th style=
"
width:25%
"
>
Date
</th>
</tr>
</thead>
<tbody>
<tr>
<td class=
"
link
"
>
<a href=
"
../
"
>Parent directory/</a>
</td>
<td class=
"
size
"
>-</td>
<td class=
"
date
"
>-</td>
</tr>
{% for entry, stat, is_dir in entries %}
<tr>
<td class=
"
link
"
>
<a href=
"
{{ entry + (
'
/
'
if is_dir else
''
) }}
"
title=
"
{{ entry }}
"
>{{ entry + (
'
/
'
if is_dir else
''
) }}</a>
</td>
<td class=
"
size
"
>{{
'
-
'
if is_dir else stat.st_size|filesizeformat }}</td>
<td class=
"
date
"
>{{ (stat.st_mtime|timestamp_to_datetime).isoformat(timespec=
'
seconds
'
) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<p><a href=
"
https://legal.cccv.de
"
>Impressum - Datenschutzerklärung</a></p>
</body>
</html>
"""
)
for
path
,
dirs
,
files
in
os
.
walk
(
inputfolder
):
relativ_path_to_input
=
os
.
path
.
relpath
(
path
,
inputfolder
)
entries
=
[(
i
,
os
.
stat
(
os
.
path
.
join
(
path
,
i
)),
i
in
dirs
)
for
i
in
dirs
+
files
if
not
i
in
ignore_files
]
html_index
=
template
.
render
(
path
=
relativ_path_to_input
,
entries
=
entries
)
html_index_folder
=
os
.
path
.
join
(
outputfolder
,
relativ_path_to_input
)
html_index_path
=
os
.
path
.
join
(
html_index_folder
,
'
index.html
'
)
os
.
makedirs
(
html_index_folder
,
exist_ok
=
True
)
outputfile
=
open
(
html_index_path
,
"
w
"
)
outputfile
.
write
(
html_index
)
outputfile
.
close
()
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
!=
3
:
print
(
f
'
Usage:
{
sys
.
argv
[
0
]
}
<directory tree to create index from> <output path for index tree>
'
)
sys
.
exit
(
1
)
main
(
inputfolder
=
sys
.
argv
[
1
],
outputfolder
=
sys
.
argv
[
2
],
ignore_files
=
[
'
index.html
'
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment